C # Type Type Type Template

I am writing / writing a value type structure and wondered if there is a manual that contains a standard template for method signatures and interface implementations. I thought I would start by looking at the System.Double documentation:

struct def

public struct Double : IComparable, IFormattable, IConvertible, IComparable<double>, IEquatable<double> 

Dual methods

How is the standard approach to creating a struct value type?

thanks

+4
source share
1 answer

There is no template as such, but there are certainly recommendations . The most important guideline is the types of values ​​that should be unchanged. Only violate this manual if you know exactly what you are doing.

In addition to the recommendations listed in the MSDN article related to I, I also recommend:

  • Override Object.Equals and Object.GetHashCode .
  • Embed == and != .
+6
source

All Articles