Future Possibilities
  • Format String of .ToString
 myInteger.ToString("X2")
  • IFormattable
  • IFormatProvider

The following two will probably require an additional tool to scan your code and produce the Diagnostics for you.
  • Method Arguments
  • Constructors
How cool would it be to validate these parameters at pre-compile time?
Along with an improvement in the error messages. major can not be negative.
        public Version(int major, int minor, int build, int revision) {
            if (major < 0) 
              throw new ArgumentOutOfRangeException("major",Environment.GetResourceString("ArgumentOutOfRange_Version"));
 
            if (minor < 0) 
              throw new ArgumentOutOfRangeException("minor",Environment.GetResourceString("ArgumentOutOfRange_Version"));
 
            if (build < 0)
              throw new ArgumentOutOfRangeException("build",Environment.GetResourceString("ArgumentOutOfRange_Version"));
            
            if (revision < 0) 
              throw new ArgumentOutOfRangeException("revision",Environment.GetResourceString("ArgumentOutOfRange_Version"));
            Contract.EndContractBlock();
            
            _Major = major;
            _Minor = minor;
            _Build = build;
            _Revision = revision;
        }

Last edited May 28, 2014 at 4:38 AM by AdamSpeight2008, version 1