Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

about structs

One question I would like to see asked ( and answered ) is:
When would we use a struct instead of a class?

By the Principle of Parsimony and using Occam's Razor we must remove structs from our C# programming vocabulary if they do not provide additional functionality or enable us to do things that we cannot ordinarily do.

If the answer is that structs merely provide increased efficiency we probably should go back to c/c++.

cheers,
Tom.

Comments

  • frazrasheedfrazrasheed Member Posts: 18
    First of all let me clear, using C# does not mean that we have forgotten things like efficiency. Yeh struct do provide efficient performance and use of memory for smaller data structures as they are created on stack rather than heap. Although most of the time we dont need structs but they may be used for better performance only.

    : One question I would like to see asked ( and answered ) is:
    : When would we use a struct instead of a class?
    :
    : By the Principle of Parsimony and using Occam's Razor we must remove structs from our C# programming vocabulary if they do not provide additional functionality or enable us to do things that we cannot ordinarily do.
    :
    : If the answer is that structs merely provide increased efficiency we probably should go back to c/c++.
    :
    : cheers,
    : Tom.
    :

Sign In or Register to comment.