System.Byte – All Methods and Fields with programming example


Objective

What is System.Byte Namespace
All Methods and Fields of byte data type
How to use methods and fields of System.Byte

System.Byte class - Methods and Fields

byte is the one of the important data type in C# which is used when need to stored small value range between 0 to 255. byte is derived from System.Byte class. When working with byte you need to do several task like comparing, converting, casting, parsing etc. System.Byte class has various methods and fields that makes byte operation easier.

Sl.NameDescription
1.CompareTo(Byte)Used for comparing with other byte variable
2.CompareTo(Object)Used for comparing with objects
3.Equals(Byte)Used for checking whether both values are equal or not.
4.Equals(Object)Used for checking whether this value is equal with object or not.
5.GetHashCodeReturns hash code for this instance
6.GetTypeUsed for Getting the Type of the current instance.
7.GetTypeCodeReturns the TypeCode for value type Byte.
8.Parse(String)Converts the string representation of a number to its Byte equivalent.
9.Parse(String, NumberStyles)Converts the string representation of a number in a specified style to its Byte equivalent.
10.Parse(String, IFormatProvider)Converts the string representation of a number in a specified culture-specific format to its Byte equivalent.
11.Parse(String, NumberStyles, IFormatProvider)Converts the string representation of a number in a specified style and culture-specific format to its Byte equivalent.
12.ToString()Converts the value of the current Byte object to its equivalent string representation. (Overrides ValueType.ToString().)
13.ToString(IFormatProvider)Converts the numeric value of the current Byte object to its equivalent string representation using the specified culture-specific formatting information.
14.ToString(String)Converts the value of the current Byte object to its equivalent string representation using the specified format.
15.ToString(String, IFormatProvider)Converts the value of the current Byte object to its equivalent string representation using the specified format and culture-specific formatting information.
16.TryParse(String, Byte)Tries to convert the string representation of a number to its Byte equivalent, and returns a value that indicates whether the conversion succeeded.
17.TryParse(String, NumberStyles, IFormatProvider, Byte)Converts the string representation of a number in a specified style and culture-specific format to its Byte equivalent. A return value indicates whether the conversion succeeded or failed.

Apart from methods, there are two fields in System.Byte Class.

Sl.NameDescription
1.MaxValueThis field is used to get largest possible value of Byte. This field is constant.
2.MinValueThis field is used to get smallest possible value of Byte. This field is constant.
Back