Click here to Skip to main content
15,888,977 members
Home / Discussions / C#
   

C#

 
GeneralRe: Error: The "GenerateResource" task failed unexpectedly in win 7 - 64 bit ? Pin
Member 24584672-Aug-17 19:00
Member 24584672-Aug-17 19:00 
GeneralRe: Error: The "GenerateResource" task failed unexpectedly in win 7 - 64 bit ? Pin
Bernhard Hiller2-Aug-17 21:04
Bernhard Hiller2-Aug-17 21:04 
GeneralRe: Error: The "GenerateResource" task failed unexpectedly in win 7 - 64 bit ? Pin
Member 24584673-Aug-17 16:31
Member 24584673-Aug-17 16:31 
QuestionHelp C# and Entity Developers Devart Pin
Alfredo Mendoza 31-Jul-17 19:18
Alfredo Mendoza 31-Jul-17 19:18 
AnswerRe: Help C# and Entity Developers Devart Pin
Pete O'Hanlon31-Jul-17 19:47
mvePete O'Hanlon31-Jul-17 19:47 
QuestionEarly session timeout in asp.net for multiple sessions Pin
punit.vk30-Jul-17 18:04
punit.vk30-Jul-17 18:04 
AnswerRe: Early session timeout in asp.net for multiple sessions Pin
OriginalGriff30-Jul-17 20:25
mveOriginalGriff30-Jul-17 20:25 
JokeC# WeakClone and DeepClone Pin
Jeong, WonYoung(Brad)28-Jul-17 20:12
professionalJeong, WonYoung(Brad)28-Jul-17 20:12 
Why have ICloneable been made?
Let's see the below test source. The outcome would turn out quite different from what we have expected.
So, we need DeepClone. but, non-serializable object needs some methods
(refer to this: A Generic Method for Deep Cloning in C# 3.0[^] ).
    class Program
    {
        static void Main(string[] args)
        {
            MyClass c1 = new MyClass();
            c1.Name = "Name1";
            c1.Value = "Value1";
            MyClass c2 = c1.Clone();
            c2.Name = "Name2";
            c2.Value = "Value2";
            c2.Lists.Add("D");//Lists was added in c2 ONLY.

<pre>
        Console.WriteLine(c1.ToString());// "D" is also added in c1. 
        Console.WriteLine(c2.ToString());
        Console.ReadLine();
    }
}
public class MyClass: ICloneable
{
    public string Name { get; set; }
    public string Value { get; set; }
    public List<string> Lists = new List<string>() { "A", "B", "C" };

    public MyClass()
    {
    }
    public MyClass(MyClass c)
    {
        Name = c.Name;
        Value = c.Value;
        Lists = c.Lists;
    }

    public MyClass Clone()
    {
        return this.MemberwiseClone() as MyClass;
    }
    object ICloneable.Clone()
    {
        return this.MemberwiseClone();
    }

    public override string ToString()
    {
        StringBuilder sb = new StringBuilder();
        sb.AppendFormat("Name={0}, ", Name);
        sb.AppendFormat("Value={0}, ", Value);
        sb.Append("Lists=");
        bool b = false;
        foreach (var item in Lists)
        {
            if (b)
                sb.AppendFormat("|{0}", item);
            else
                sb.AppendFormat("{0}", item); b = true;
        }                
        return sb.ToString();
    }
}</pre>
Brad
You go, we go~.

GeneralRe: C# WeakClone and DeepClone Pin
Pete O'Hanlon29-Jul-17 3:23
mvePete O'Hanlon29-Jul-17 3:23 
GeneralRe: C# WeakClone and DeepClone Pin
Jeong, WonYoung(Brad)29-Jul-17 12:34
professionalJeong, WonYoung(Brad)29-Jul-17 12:34 
GeneralRe: C# WeakClone and DeepClone Pin
BillWoodruff29-Jul-17 6:18
professionalBillWoodruff29-Jul-17 6:18 
GeneralRe: C# WeakClone and DeepClone Pin
Jeong, WonYoung(Brad)29-Jul-17 12:36
professionalJeong, WonYoung(Brad)29-Jul-17 12:36 
GeneralRe: C# WeakClone and DeepClone Pin
BillWoodruff29-Jul-17 17:55
professionalBillWoodruff29-Jul-17 17:55 
QuestionIntermittent AccessViolationException with richtextbox Pin
shrishjain27-Jul-17 20:28
shrishjain27-Jul-17 20:28 
QuestionRe: Intermittent AccessViolationException with richtextbox Pin
Jochen Arndt27-Jul-17 23:01
professionalJochen Arndt27-Jul-17 23:01 
QuestionGet host name from different segment of LAN Pin
w1424327-Jul-17 17:39
w1424327-Jul-17 17:39 
AnswerRe: Get host name from different segment of LAN Pin
Jochen Arndt27-Jul-17 22:04
professionalJochen Arndt27-Jul-17 22:04 
AnswerRe: Get host name from different segment of LAN Pin
Nathan Minier28-Jul-17 1:19
professionalNathan Minier28-Jul-17 1:19 
AnswerRe: Get host name from different segment of LAN Pin
Member 1333447128-Jul-17 8:42
Member 1333447128-Jul-17 8:42 
QuestionCOM and C#.net Interoperability Pin
Vijjuuu.26-Jul-17 8:59
Vijjuuu.26-Jul-17 8:59 
AnswerRe: COM and C#.net Interoperability Pin
Richard MacCutchan26-Jul-17 10:05
mveRichard MacCutchan26-Jul-17 10:05 
AnswerRe: COM and C#.net Interoperability Pin
Bernhard Hiller26-Jul-17 22:05
Bernhard Hiller26-Jul-17 22:05 
GeneralRe: COM and C#.net Interoperability Pin
Vijjuuu.27-Jul-17 7:27
Vijjuuu.27-Jul-17 7:27 
GeneralRe: COM and C#.net Interoperability Pin
Pete O'Hanlon27-Jul-17 20:46
mvePete O'Hanlon27-Jul-17 20:46 
AnswerRe: COM and C#.net Interoperability Pin
BenScharbach12-Aug-17 10:21
BenScharbach12-Aug-17 10:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.