struct is a value type in C#. when we assign a struct to another struct variable, it will copy the values. how about if that struct contains another struct? It will automatically copy the values of the inner struct?
struct is a value type in C#. when we assign a struct to another
Share
Yes it will. Here’s an example showing it in action:
Yes. In general though it can be a bad idea to make such complex structs – they should typically hold just a few simple values. If you have structs inside structs inside structs you might want to consider if a reference type would be more suitable.