Format byte to Hexadecimal with X4 in CSharp

Description

The following code shows how to format byte to Hexadecimal with X4.

Example


using System;//  w w w  .  j a  v a2  s . c  o m

public class MainClass{
    public static void Main(){
        byte[] byteValues = { 12, 163, 255 };
        foreach (byte byteValue in byteValues)
           Console.WriteLine(byteValue.ToString("X4"));
    }
}




















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var