Forums - C# Corner

Forum guidelines
peter uss

peter uss

  • 0
  • 3
  • 0

C# Adding a Class To List changes all data previously added

Dec 13 2012 3:24 PM

C# Adding a Class To A List Of Classes changes all data in previously added Classes.
The new class is added to the list as expected.
But data in every class that has been previously added changes to match the newly added class.

tCardInfo2.Add(new TCardInfoClass(cardType.ToString(),strReqID, true));

public static List<TCardInfoClass> tCardInfo2 = new List<TCardInfoClass>();

public class TCardInfoClass // dragon
       static private string arrayID;
       static private string reqId;
       static private bool visible = false;

      public TCardInfoClass(string ArrayID, string ReqID, bool Visible)
     arrayID = ArrayID;
reqId = ReqID;
visible = Visible;


Answers (1)