Export (0) Print
Expand All

UInt16.MaxValue Field

Represents the largest possible value of UInt16. This field is constant.

The UInt16 type is not CLS-compliant. The CLS-compliant alternative type is Int32. Int16 can be used when the original value is less than half of UInt16.MaxValue. For more information about CLS compliance, see What is the Common Language Specification.

[C#]
public const ushort MaxValue;
[C++]
public: const unsigned short MaxValue;
[JScript]
public var MaxValue : UInt16;

[Visual Basic] Visual Basic does not support constant fields of type UInt16.

Remarks [C#, C++, JScript]

The value of this constant is 65535; that is, hexadecimal 0xFFFF.

Example

[C#] 
public class Temperature {
    public static ushort MinValue {
        get {
            return UInt16.MinValue;
        }
    }

    public static ushort MaxValue {
        get {
            return UInt16.MaxValue;
        }
    }

    // The value holder
    protected ushort m_value;

    public ushort Value {
        get {
            return m_value;
        }
        set {
            m_value = value;
        }
    }

}

[C++] 

    public __gc class Temperature {
    // The value holder
    protected:
        short m_value;

    public:
        __property static short get_MinValue() {
            return UInt16::MinValue;
        };

        __property static short get_MaxValue() {
            return UInt16::MaxValue;
        };

        __property short get_Value(){
            return m_value;
        };
        __property void set_Value( short value){
            m_value = value;
        };

        __property short get_Celsius(){
            return (short)((m_value-32)/2);
        };

        __property void set_Celsius( short value){
            m_value = (short)(value*2+32);
        };
    };

[JScript] 
public class Temperature {
    public static function get MinValue() : ushort {
        return UInt16.MinValue;
    }

    public static function get MaxValue() : ushort {
        return UInt16.MaxValue;
    }

    // The value holder
    protected var m_value : ushort ;

    public function get Value() : ushort {
        return m_value;
            }
            
            public function set Value(value : ushort) {                        
        m_value = value;
    }

}

[Visual Basic] No example is available for Visual Basic. To view a C#, C++, or JScript example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

UInt16 Structure | UInt16 Members | System Namespace | MinValue

Show:
© 2015 Microsoft