C#C
C#3y ago
DaVinki

❔ Are there standards to whether someone should use fields or properties?

I always spend a second thinking if I should use fields or properties when I am making classes. I'm not sure which one to use ever aside from having a public getter and private setter but it always works out anyways lol. Is there a standard that I can follow in order to properly use fields and properties?

I also have a question about using reference types in structs. I have read in most places that it is generally frowned upon to use reference type inside of structures, but I have also seen and read many things that do this. What is the general consensus on using reference types inside of structures, or when is it OK to do this?
Was this page helpful?