Home > Net >  The.net CORE source don't understand
The.net CORE source don't understand

Time:03-07

In order to study value type, look at the.net CORE source INT defined in
 
[Serializable]
[StructLayout (LayoutKind. Sequential)]
[TypeForwardedFrom (" mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ")]
Public readonly struct Int16: IComparable, IConvertible, IFormattable, IComparable IEquatable , ISpanFormattable
{
Private readonly short m_value;//Do not rename (binary serialization)

Public const short MaxValue=https://bbs.csdn.net/topics/(short) 0 x7fff;
Public const short MinValue=https://bbs.csdn.net/topics/unchecked ((short) 0 x8000);

//Compares this object to another object, returning an integer that
//are the relationship.
//Returns a value less than zero if this object
//null is considered to be less than any instance.
//If the object is not of type Int16, this method throws an ArgumentException.
//
Public int CompareTo (object? Value)
{
If (value=null https://bbs.csdn.net/topics/=
{
return 1;
}

If value is ()
{
Return m_value - ((short) value). M_value;
}

Throw new ArgumentException (SR. Arg_MustBeInt16);
}

Public int CompareTo (short value)
{
Return m_value - value;
}

Public override bool Equals ([NotNullWhen (true)] object? Obj)
{
if (! (obj is))
{
return false;
}
Return m_value=https://bbs.csdn.net/topics/=((short) obj). M_value;
}


M_value this variable assignment, how to operate it,
Another is the incoming are short type
  •  Tags:  
  • C#
  • Related