Please describe in brief...
Difference between Structs (Structures) vs Classes in C#
1380
11-Dec-2018
Anonymous User
12-Dec-2018Difference between Structs (Structures) vs Classes in C#
when to use struct or classes?
Into the structs, each variable contains its own copy of the data (except in the case of the ref and out parameter variables), and any operation on one variable does not affect another variable.
In this way, struct should be used only when you are sure that -
This logically represents a single value, like primitive types (int, double, etc.).
This is immutable.
This should not be boxed and un-boxed frequently.
Into the all other cases, you should define your types as classes.
Thank You!!! for reading this article.
Hi,
Rahul.
I hope this will definitely help you.