Maybe this is a newbie question, but can someone explain to me how the linked / linked classes are created (I don't know their real names)? An example could be LINQ TO XML .
When I have the code below:
XDocument doc = XDocument.Load("..."); XElement element = doc.Element("root"); element.SetAttribute("NewAttribute", "BlahBlah"); doc.Save("...");
I only change the element variable (I do not need to update it in the doc because it refers). How to create such classes?
[edit]
I tried @animaonline code and it works
A a = new A(); B b = aB(0); b.Name = "asd"; Console.WriteLine(a.Bs[0].Name); // output "asd"
But tell me, what is the difference with the code above and below?
List<string> list = new List<string>(); list.Add("test1"); list.Add("test2"); var test = list.FirstOrDefault(); test = "asdasda"; Console.WriteLine(list[0]);
source share