What is a Class and structure's? Structures are value types and classes are reference types.. When to use Structures and When to use classes? You will use structures when: – Point 1:- If you want to represent a custom value type. This custom value type is derived from primitive data types (int, double). Some of the example's of custom types are co-ordinates (which have X, Y), complex numbers (which have real and imaginary components). You can also term these things as value objects or technical objects. Technical objects do not represent real world objects like customer, supplier, invoice etc. Point 2:- If you want to have low memory foot print. For instance let's say you want to plot a graph. To plot a graph you need to have 100's of objects created so that you can represent co-ordinates. Now if you create a class and generate those 100's of objects you end up putting lot of load on your garbage collector. If you create a "struct" , it's a value type. So they get created and destroyed immediately.
I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.
Stay tuned to my blog, twitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.
Stay tuned to my blog, twitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.
This article is related to
Uncategorized,(Information technology) IT interview questions with answers,.NET basic training,.Net Interview Questions,.NET step by step training,class,Csharp interview questions,programming interview questions,structure
Uncategorized,(Information technology) IT interview questions with answers,.NET basic training,.Net Interview Questions,.NET step by step training,class,Csharp interview questions,programming interview questions,structure
0 Comments