Skip to main content
Code Review

Return to Answer

Added a new point
Source Link
Johnbot
  • 3.1k
  • 16
  • 19
public struct IdentifierReference

You should not be using structs unless you have a very good reason to. MSDN has the following [guidelines][1]guidelines for choosing between structs and classes:

CONSIDER defining a struct instead of a class if instances of the type are small and commonly short-lived or are commonly embedded in other objects.

X AVOID defining a struct unless the type has all of the following characteristics:

  • It logically represents a single value, similar to primitive types (int, double, etc.).
  • It has an instance size under 16 bytes.
  • It is immutable.
  • It will not have to be boxed frequently.

Your struct exceeds the recommended size both on 32bit and even more so on 64bit where pointers are 8 bytes. [1]:

Also from MSDN, this time on https://msdn.microsoft.com/en-us/library/ms229017(v=vs.110).aspx struct design :

DO ensure that a state where all instance data is set to zero, false, or null (as appropriate) is valid.

public struct IdentifierReference

You should not be using structs unless you have a very good reason to. MSDN has the following [guidelines][1] for choosing between structs and classes:

CONSIDER defining a struct instead of a class if instances of the type are small and commonly short-lived or are commonly embedded in other objects.

X AVOID defining a struct unless the type has all of the following characteristics:

  • It logically represents a single value, similar to primitive types (int, double, etc.).
  • It has an instance size under 16 bytes.
  • It is immutable.
  • It will not have to be boxed frequently.

Your struct exceeds the recommended size both on 32bit and even more so on 64bit where pointers are 8 bytes. [1]: https://msdn.microsoft.com/en-us/library/ms229017(v=vs.110).aspx

public struct IdentifierReference

You should not be using structs unless you have a very good reason to. MSDN has the following guidelines for choosing between structs and classes:

CONSIDER defining a struct instead of a class if instances of the type are small and commonly short-lived or are commonly embedded in other objects.

X AVOID defining a struct unless the type has all of the following characteristics:

  • It logically represents a single value, similar to primitive types (int, double, etc.).
  • It has an instance size under 16 bytes.
  • It is immutable.
  • It will not have to be boxed frequently.

Your struct exceeds the recommended size both on 32bit and even more so on 64bit where pointers are 8 bytes.

Also from MSDN, this time on struct design :

DO ensure that a state where all instance data is set to zero, false, or null (as appropriate) is valid.

Source Link
Johnbot
  • 3.1k
  • 16
  • 19
public struct IdentifierReference

You should not be using structs unless you have a very good reason to. MSDN has the following [guidelines][1] for choosing between structs and classes:

CONSIDER defining a struct instead of a class if instances of the type are small and commonly short-lived or are commonly embedded in other objects.

X AVOID defining a struct unless the type has all of the following characteristics:

  • It logically represents a single value, similar to primitive types (int, double, etc.).
  • It has an instance size under 16 bytes.
  • It is immutable.
  • It will not have to be boxed frequently.

Your struct exceeds the recommended size both on 32bit and even more so on 64bit where pointers are 8 bytes. [1]: https://msdn.microsoft.com/en-us/library/ms229017(v=vs.110).aspx

lang-cs

AltStyle によって変換されたページ (->オリジナル) /