tag:blogger.com,1999:blog-9164837514531450619.post6336687225606756232..comments2023-09-06T03:43:03.791-07:00Comments on .Net Goodies: .Net Framework | Value TypesA.m.a.L Hashimhttp://www.blogger.com/profile/04600206670507170118noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-9164837514531450619.post-57951971058074121782010-08-18T12:46:52.394-07:002010-08-18T12:46:52.394-07:00@Sen:
If a structure is not larger than 16 bytes,...@Sen:<br /><br />If a structure is not larger than 16 bytes, it can be copied with a few simple processor instructions. If it's larger, a loop is used to copy the structure. As long as the structure is not larger than 16 bytes, the processor has to do about the same work when copying the structure as when copying a reference. If the structure is larger, you lose the performance benefit of having s structure, and you should generally make it a class instead.<br /><br />Real world scenarios...hmmmm....simple and only one rule of thumb, if size of the object is less than 16 go for structA.m.a.L Hashimhttps://www.blogger.com/profile/04600206670507170118noreply@blogger.comtag:blogger.com,1999:blog-9164837514531450619.post-14587141578196296472010-08-18T11:41:54.806-07:002010-08-18T11:41:54.806-07:00I didnt get the point "Note: Always make use ...I didnt get the point "Note: Always make use of a structure only if the entire data in it constitute less than 16 bytes." Can you please explain it.<br />It would be appreciable if you give one real time scinario where Class should avoid and Structure should use.<br /><a href="http://aspdotnet-authority.blogspot.com/" rel="nofollow">The Zen of dotnet programming world</a>Sen Thomashttps://www.blogger.com/profile/09190965147842770875noreply@blogger.com