C# references | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C# references

Hey community! I've got a short question regarding C# i'll demonstrate with a code: class Person { int age {get;set;} } If i would now call the getter, would I get a reference to age or a copy?

25th May 2017, 2:42 PM
Daniel S
Daniel S - avatar
2 Answers
+ 1
You'll get a copy of the age property for each object of class Person that you instantiate.
25th May 2017, 4:25 PM
Álvaro
0
thanks, is there a way to return the reference
25th May 2017, 4:32 PM
Daniel S
Daniel S - avatar