Byte 구조체

정의

부호 없는 8비트 정수를 나타냅니다.

public value class System::Byte : IComparable, IComparable<System::Byte>, IConvertible, IEquatable<System::Byte>, IFormattable
public value class System::Byte : IComparable, IComparable<System::Byte>, IConvertible, IEquatable<System::Byte>, ISpanFormattable
public value class System::Byte : IComparable, IConvertible, IFormattable
public value class System::Byte : IComparable, IComparable<System::Byte>, IEquatable<System::Byte>, IFormattable
public struct Byte : IComparable, IComparable<byte>, IConvertible, IEquatable<byte>, IFormattable
public struct Byte : IComparable, IComparable<byte>, IConvertible, IEquatable<byte>, ISpanFormattable
[System.Serializable]
public struct Byte : IComparable, IConvertible, IFormattable
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public struct Byte : IComparable, IComparable<byte>, IConvertible, IEquatable<byte>, IFormattable
public struct Byte : IComparable, IComparable<byte>, IEquatable<byte>, IFormattable
type byte = struct
    interface IConvertible
    interface IFormattable
type byte = struct
    interface IConvertible
    interface ISpanFormattable
    interface IFormattable
[<System.Serializable>]
type byte = struct
    interface IFormattable
    interface IConvertible
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type byte = struct
    interface IFormattable
    interface IConvertible
type byte = struct
    interface IFormattable
Public Structure Byte
Implements IComparable, IComparable(Of Byte), IConvertible, IEquatable(Of Byte), IFormattable
Public Structure Byte
Implements IComparable, IComparable(Of Byte), IConvertible, IEquatable(Of Byte), ISpanFormattable
Public Structure Byte
Implements IComparable, IConvertible, IFormattable
Public Structure Byte
Implements IComparable, IComparable(Of Byte), IEquatable(Of Byte), IFormattable
상속
특성
구현

설명

Byte 는 상수로 표현 되는 0에서 Byte.MinValue 255 (상수로 표현 됨) 까지의 값을 가진 부호 없는 정수를 나타내는 변경할 수 없는 값 형식입니다 Byte.MaxValue . 또한 .NET에는 SByte -128 ~ 127 범위의 값을 나타내는 부호 있는 8 비트 정수 값 형식가 포함 되어 있습니다.

바이트 값 인스턴스화

Byte다음과 같은 여러 가지 방법으로 값을 인스턴스화할 수 있습니다.

  • 변수를 선언 Byte 하 고 데이터 형식 범위 내에 있는 리터럴 정수 값을 할당할 수 있습니다 Byte . 다음 예제에서는 두 Byte 변수를 선언 하 고 이러한 방식으로 값을 할당 합니다.

    byte value1 = 64;
    byte value2 = 255;
    
    let value1 = 64uy
    let value2 = 255uy
    
    Dim value1 As Byte = 64
    Dim value2 As Byte = 255
    
  • 바이트에 바이트가 아닌 숫자 값을 할당할 수 있습니다. 이는 축소 변환 이므로 c # 및 F #에서 캐스트 연산자가 필요 하거나가 on 인 경우 Visual Basic의 변환 메서드가 필요 Option Strict 합니다. 바이트가 아닌 값이 Single Double Decimal 소수 구성 요소를 포함 하는, 또는 값인 경우 소수 부분을 처리 하는 작업은 변환을 수행 하는 컴파일러에 따라 다릅니다. 다음 예에서는 변수에 여러 개의 숫자 값을 할당 Byte 합니다.

    int int1 = 128;
    try {
       byte value1 = (byte) int1;
       Console.WriteLine(value1);
    }
    catch (OverflowException) {
       Console.WriteLine("{0} is out of range of a byte.", int1);
    }
    
    double dbl2 = 3.997;
    try {
       byte value2 = (byte) dbl2;
       Console.WriteLine(value2);
    }
    catch (OverflowException) {
       Console.WriteLine("{0} is out of range of a byte.", dbl2);
    }
    // The example displays the following output:
    //       128
    //       3
    
    let int1 = 128
    try
        let value1 = byte int1
        printfn $"{value1}"
    with :? OverflowException ->
        printfn $"{int1} is out of range of a byte."
    
    let dbl2 = 3.997
    try
        let value2 = byte dbl2
        printfn $"{value2}"
    with :? OverflowException ->
        printfn $"{dbl2} is out of range of a byte."
    
    // The example displays the following output:
    //       128
    //       3
    
    Dim int1 As Integer = 128
    Try
       Dim value1 As Byte = CByte(int1)
       Console.WriteLine(value1)
    Catch e As OverflowException
       Console.WriteLine("{0} is out of range of a byte.", int1)
    End Try
    
    Dim dbl2 As Double = 3.997
    Try
       Dim value2 As Byte = CByte(dbl2)
       Console.WriteLine(value2)
    Catch e As OverflowException
       Console.WriteLine("{0} is out of range of a byte.", dbl2)
    End Try   
    ' The example displays the following output:
    '       128
    '       4
    
  • 클래스의 메서드를 호출 하 여 Convert 지원 되는 모든 형식을 값으로 변환할 수 있습니다 Byte . 는 인터페이스를 지원 하기 때문에 가능 Byte IConvertible 합니다. 다음 예제에서는 값 배열을 값으로 변환 하는 방법을 보여 줍니다 Int32 Byte .

    int[] numbers = { Int32.MinValue, -1, 0, 121, 340, Int32.MaxValue };
    byte result;
    foreach (int number in numbers)
    {
       try {
          result = Convert.ToByte(number);
          Console.WriteLine("Converted the {0} value {1} to the {2} value {3}.",
                            number.GetType().Name, number,
                            result.GetType().Name, result);
       }
       catch (OverflowException) {
          Console.WriteLine("The {0} value {1} is outside the range of the Byte type.",
                            number.GetType().Name, number);
       }
    }
    // The example displays the following output:
    //       The Int32 value -2147483648 is outside the range of the Byte type.
    //       The Int32 value -1 is outside the range of the Byte type.
    //       Converted the Int32 value 0 to the Byte value 0.
    //       Converted the Int32 value 121 to the Byte value 121.
    //       The Int32 value 340 is outside the range of the Byte type.
    //       The Int32 value 2147483647 is outside the range of the Byte type.
    
    open System
    
    let numbers = [| Int32.MinValue; -1; 0; 121; 340; Int32.MaxValue |]
    
    for number in numbers do
        try
            let result = Convert.ToByte number
            printfn $"Converted the {number.GetType().Name} value {number} to the {result.GetType().Name} value {result}."
    
        with :? OverflowException ->
            printfn $"The {number.GetType().Name} value {number} is outside the range of the Byte type."
    
    
    // The example displays the following output:
    //       The Int32 value -2147483648 is outside the range of the Byte type.
    //       The Int32 value -1 is outside the range of the Byte type.
    //       Converted the Int32 value 0 to the Byte value 0.
    //       Converted the Int32 value 121 to the Byte value 121.
    //       The Int32 value 340 is outside the range of the Byte type.
    //       The Int32 value 2147483647 is outside the range of the Byte type.
    
    Dim numbers() As Integer = { Int32.MinValue, -1, 0, 121, 340, Int32.MaxValue }
    Dim result As Byte
    For Each number As Integer In numbers
       Try
          result = Convert.ToByte(number)
          Console.WriteLIne("Converted the {0} value {1} to the {2} value {3}.", _
                            number.GetType().Name, number, _
                            result.GetType().Name, result)
       Catch e As OverflowException
          Console.WriteLine("The {0} value {1} is outside the range of the Byte type.", _
                            number.GetType().Name, number)
       End Try
    Next
    ' The example displays the following output:
    '       The Int32 value -2147483648 is outside the range of the Byte type.
    '       The Int32 value -1 is outside the range of the Byte type.
    '       Converted the Int32 value 0 to the Byte value 0.
    '       Converted the Int32 value 121 to the Byte value 121.
    '       The Int32 value 340 is outside the range of the Byte type.
    '       The Int32 value 2147483647 is outside the range of the Byte type.
    
  • 또는 메서드를 호출 Parse TryParse 하 여 값의 문자열 표현을로 변환할 수 있습니다 Byte Byte . 문자열에는 10 진수 또는 16 진수가 포함 될 수 있습니다. 다음 예제에서는 10 진수 및 16 진수 문자열을 모두 사용 하 여 구문 분석 작업을 보여 줍니다.

    string string1 = "244";
    try {
       byte byte1 = Byte.Parse(string1);
       Console.WriteLine(byte1);
    }
    catch (OverflowException) {
       Console.WriteLine("'{0}' is out of range of a byte.", string1);
    }
    catch (FormatException) {
       Console.WriteLine("'{0}' is out of range of a byte.", string1);
    }
    
    string string2 = "F9";
    try {
       byte byte2 = Byte.Parse(string2,
                               System.Globalization.NumberStyles.HexNumber);
       Console.WriteLine(byte2);
    }
    catch (OverflowException) {
       Console.WriteLine("'{0}' is out of range of a byte.", string2);
    }
    catch (FormatException) {
       Console.WriteLine("'{0}' is out of range of a byte.", string2);
    }
    // The example displays the following output:
    //       244
    //       249
    
    let string1 = "244"
    try
        let byte1 = Byte.Parse string1
        printfn $"{byte1}" 
    with
    | :? OverflowException ->
        printfn $"'{string1}' is out of range of a byte."
    | :? FormatException ->
        printfn $"'{string1}' is out of range of a byte."
    
    let string2 = "F9"
    try
        let byte2 = Byte.Parse(string2, System.Globalization.NumberStyles.HexNumber)
        printfn $"{byte2}"
    with
    | :? OverflowException ->
        printfn $"'{string2}' is out of range of a byte."
    | :? FormatException ->
        printfn $"'{string2}' is out of range of a byte."
    
    // The example displays the following output:
    //       244
    //       249
    
    Dim string1 As String = "244"
    Try
       Dim byte1 As Byte = Byte.Parse(string1)
       Console.WriteLine(byte1)
    Catch e As OverflowException
       Console.WriteLine("'{0}' is out of range of a byte.", string1)
    Catch e As FormatException
       Console.WriteLine("'{0}' is out of range of a byte.", string1)
    End Try
    
    Dim string2 As String = "F9"
    Try
       Dim byte2 As Byte = Byte.Parse(string2,
                                 System.Globalization.NumberStyles.HexNumber)
       Console.WriteLine(byte2)
    Catch e As OverflowException
       Console.WriteLine("'{0}' is out of range of a byte.", string2)
    Catch e As FormatException
       Console.WriteLine("'{0}' is out of range of a byte.", string2)
    End Try
    ' The example displays the following output:
    '       244
    '       249
    

바이트 값에 대 한 작업 수행

Byte 형식은 더하기, 빼기, 나누기, 곱하기, 빼기, 부정 및 단항 부정을 비롯 한 표준 수치 연산을 지원 합니다. 다른 정수 계열 형식과 마찬가지로 Byte 형식도 비트 AND , OR , XOR , 왼쪽 시프트 및 오른쪽 시프트 연산자를 지원 합니다.

표준 숫자 연산자를 사용 하 여 두 Byte 값을 비교 하거나 또는 메서드를 호출할 수 CompareTo 있습니다 Equals .

또한 클래스의 멤버를 호출 하 여 Math 숫자의 절대값을 가져오고 정수 나누기에서 몫과 나머지를 계산 하 고, 두 정수의 최대값 또는 최소값을 확인 하 고, 숫자의 부호를 가져오고, 숫자를 반올림 하는 등의 다양 한 숫자 연산을 수행할 수 있습니다.

바이트를 문자열로 표시

Byte형식은 표준 및 사용자 지정 숫자 형식 문자열을 완벽 하 게 지원 합니다. 자세한 내용은 서식 지정 형식, 표준 숫자 형식 문자열사용자 지정 숫자 형식 문자열을 참조 하세요. 그러나 가장 일반적으로 바이트 값은 추가 서식 지정 없이 1 자리에서 3 자리 숫자 값으로, 두 자리 16 진수 값으로 표현 됩니다.

값의 형식을 Byte 앞에 오는 0 없이 정수 계열 문자열로 지정 하려면 매개 변수가 없는 메서드를 호출 하면 ToString() 됩니다. "D" 형식 지정자를 사용 하 여 문자열 표현에 지정 된 수의 앞에 오는 0을 포함할 수도 있습니다. "X" 형식 지정자를 사용 하 여 Byte 값을 16 진수 문자열로 나타낼 수 있습니다. 다음 예제에서는 Byte 이러한 세 가지 방법으로 값의 배열에 있는 요소의 형식을 지정 합니다.

byte[] numbers = { 0, 16, 104, 213 };
foreach (byte number in numbers) {
   // Display value using default formatting.
   Console.Write("{0,-3}  -->   ", number.ToString());
   // Display value with 3 digits and leading zeros.
   Console.Write(number.ToString("D3") + "   ");
   // Display value with hexadecimal.
   Console.Write(number.ToString("X2") + "   ");
   // Display value with four hexadecimal digits.
   Console.WriteLine(number.ToString("X4"));
}
// The example displays the following output:
//       0    -->   000   00   0000
//       16   -->   016   10   0010
//       104  -->   104   68   0068
//       213  -->   213   D5   00D5
let numbers = [| 0; 16; 104; 213 |]
for number in numbers do
    // Display value using default formatting.
    number.ToString()
    |> printf "%-3s  -->   "

    // Display value with 3 digits and leading zeros.
    number.ToString "D3"
    |> printf "%s   "
    
    // Display value with hexadecimal.
    number.ToString "X2"
    |> printf "%s   "
    
    // Display value with four hexadecimal digits.
    number.ToString "X4"
    |> printfn "%s"

// The example displays the following output:
//       0    -->   000   00   0000
//       16   -->   016   10   0010
//       104  -->   104   68   0068
//       213  -->   213   D5   00D5
Dim numbers() As Byte = { 0, 16, 104, 213 }
For Each number As Byte In numbers
   ' Display value using default formatting.
   Console.Write("{0,-3}  -->   ", number.ToString())
   ' Display value with 3 digits and leading zeros.
   Console.Write(number.ToString("D3") + "   ")
   ' Display value with hexadecimal.
   Console.Write(number.ToString("X2") + "   ")
   ' Display value with four hexadecimal digits.
   Console.WriteLine(number.ToString("X4"))
Next   
' The example displays the following output:
'       0    -->   000   00   0000
'       16   -->   016   10   0010
'       104  -->   104   68   0068
'       213  -->   213   D5   00D5

또한 Byte 메서드를 호출 ToString(Byte, Int32) 하 고 기본을 메서드의 두 번째 매개 변수로 제공 하 여 값의 형식을 이진, 8 진수, 10 진수 또는 16 진수 문자열로 지정할 수 있습니다. 다음 예제에서는이 메서드를 호출 하 여 바이트 값 배열의 이진, 8 진수 및 16 진수 표현을 표시 합니다.

byte[] numbers ={ 0, 16, 104, 213 };
Console.WriteLine("{0}   {1,8}   {2,5}   {3,5}",
                  "Value", "Binary", "Octal", "Hex");
foreach (byte number in numbers) {
   Console.WriteLine("{0,5}   {1,8}   {2,5}   {3,5}",
                     number, Convert.ToString(number, 2),
                     Convert.ToString(number, 8),
                     Convert.ToString(number, 16));
}
// The example displays the following output:
//       Value     Binary   Octal     Hex
//           0          0       0       0
//          16      10000      20      10
//         104    1101000     150      68
//         213   11010101     325      d5
let numbers = [| 0; 16; 104; 213 |]
printfn "%s   %8s   %5s   %5s" "Value" "Binary" "Octal" "Hex"
for number in numbers do
    printfn $"%5i{number}   %8s{Convert.ToString(number, 2)}   %5s{Convert.ToString(number, 8)}   %5s{Convert.ToString(number, 16)}"
                    
// The example displays the following output:
//       Value     Binary   Octal     Hex
//           0          0       0       0
//          16      10000      20      10
//         104    1101000     150      68
//         213   11010101     325      d5
Dim numbers() As Byte = { 0, 16, 104, 213 }
Console.WriteLine("{0}   {1,8}   {2,5}   {3,5}", _
                  "Value", "Binary", "Octal", "Hex")
For Each number As Byte In numbers
   Console.WriteLine("{0,5}   {1,8}   {2,5}   {3,5}", _
                     number, Convert.ToString(number, 2), _
                     Convert.ToString(number, 8), _
                     Convert.ToString(number, 16))
Next      
' The example displays the following output:
'       Value     Binary   Octal     Hex
'           0          0       0       0
'          16      10000      20      10
'         104    1101000     150      68
'         213   11010101     325      d5

10 진수가 아닌 바이트 값으로 작업

개별 바이트를 10 진수 값으로 사용 하는 것 외에 바이트 값을 사용 하 여 비트 연산을 수행 하거나 바이트 배열 또는 바이트 값의 이진 또는 16 진수 표현을 사용 하 여 작업할 수 있습니다. 예를 들어 메서드의 오버 로드는 BitConverter.GetBytes 각 기본 데이터 형식을 바이트 배열로 변환할 수 있으며, BigInteger.ToByteArray 메서드는 BigInteger 값을 바이트 배열로 변환 합니다.

Byte 값은 부호 비트 없이는 크기에 의해서만 8 비트로 표시 됩니다. 이는 값에 대 한 비트 연산을 수행 하는 경우 Byte 또는 개별 비트로 작업할 때 유념 해야 합니다. 10 진수가 아닌 두 값에 대해 숫자, 부울 또는 비교 연산을 수행 하려면 두 값 모두 동일한 표현을 사용 해야 합니다.

두 값에 대해 작업을 수행 Byte 하는 경우 값은 동일한 표현을 공유 하므로 결과는 정확 합니다. 이는 값의 최하위 비트를 표시 하 여 짝수 인지 확인 하는 다음 예제에 나와 Byte 있습니다.

using System;
using System.Globalization;

public class Example
{
   public static void Main()
   {
      string[] values = { Convert.ToString(12, 16),
                          Convert.ToString(123, 16),
                          Convert.ToString(245, 16) };

      byte mask = 0xFE;
      foreach (string value in values) {
         Byte byteValue = Byte.Parse(value, NumberStyles.AllowHexSpecifier);
         Console.WriteLine("{0} And {1} = {2}", byteValue, mask,
                           byteValue & mask);
      }
   }
}
// The example displays the following output:
//       12 And 254 = 12
//       123 And 254 = 122
//       245 And 254 = 244
open System
open System.Globalization

let values = 
    [ Convert.ToString(12, 16)
      Convert.ToString(123, 16)
      Convert.ToString(245, 16) ]

let mask = 0xFEuy
for value in values do
    let byteValue = Byte.Parse(value, NumberStyles.AllowHexSpecifier)
    printfn $"{byteValue} And {mask} = {byteValue &&& mask}"
                    

// The example displays the following output:
//       12 And 254 = 12
//       123 And 254 = 122
//       245 And 254 = 244
Imports System.Globalization

Module Example
   Public Sub Main()
      Dim values() As String = { Convert.ToString(12, 16), _
                                 Convert.ToString(123, 16), _
                                 Convert.ToString(245, 16) }
      
      Dim mask As Byte = &hFE
      For Each value As String In values
         Dim byteValue As Byte = Byte.Parse(value, NumberStyles.AllowHexSpecifier)
         Console.WriteLine("{0} And {1} = {2}", byteValue, mask, _ 
                           byteValue And mask)
      Next         
   End Sub
End Module
' The example displays the following output:
'       12 And 254 = 12
'       123 And 254 = 122
'       245 And 254 = 244

반면에 부호 없는 비트 및 부호 있는 비트를 모두 사용 하는 경우 SByte 값에서 양수 값에 대 한 부호 및 크기 표현을 사용 하 고 음수 값에 대해 두 개의 보수 표현을 사용 하므로 비트 연산은 복잡 합니다. 의미 있는 비트 연산을 수행 하려면 값을 두 개의 동일한 표현으로 변환 하 고 부호 비트에 대 한 정보를 유지 해야 합니다. 다음 예제에서는 부호 있는 8 비트 값과 부호 없는 값 배열의 비트 2와 4를 마스킹 하기 위해이를 수행 합니다.

using System;
using System.Collections.Generic;
using System.Globalization;

public struct ByteString
{
   public string Value;
   public int Sign;
}

public class Example
{
   public static void Main()
   {
      ByteString[] values = CreateArray(-15, 123, 245);

      byte mask = 0x14;        // Mask all bits but 2 and 4.

      foreach (ByteString strValue in values) {
         byte byteValue = Byte.Parse(strValue.Value, NumberStyles.AllowHexSpecifier);
         Console.WriteLine("{0} ({1}) And {2} ({3}) = {4} ({5})",
                           strValue.Sign * byteValue,
                           Convert.ToString(byteValue, 2),
                           mask, Convert.ToString(mask, 2),
                           (strValue.Sign & Math.Sign(mask)) * (byteValue & mask),
                           Convert.ToString(byteValue & mask, 2));
      }
   }

   private static ByteString[] CreateArray(params int[] values)
   {
      List<ByteString> byteStrings = new List<ByteString>();

      foreach (object value in values) {
         ByteString temp = new ByteString();
         int sign = Math.Sign((int) value);
         temp.Sign = sign;

         // Change two's complement to magnitude-only representation.
         temp.Value = Convert.ToString(((int) value) * sign, 16);

         byteStrings.Add(temp);
      }
      return byteStrings.ToArray();
   }
}
// The example displays the following output:
//       -15 (1111) And 20 (10100) = 4 (100)
//       123 (1111011) And 20 (10100) = 16 (10000)
//       245 (11110101) And 20 (10100) = 20 (10100)
open System
open System.Collections.Generic
open System.Globalization

[<Struct>]
type ByteString =
    { Sign: int
      Value: string }

let createArray values =
    [ for value in values do
        let sign = sign value
        { Sign = sign
         // Change two's complement to magnitude-only representation.
          Value = Convert.ToString(value * sign, 16)} ]


let values = createArray [ -15; 123; 245 ]

let mask = 0x14uy        // Mask all bits but 2 and 4.

for strValue in values do
    let byteValue = Byte.Parse(strValue.Value, NumberStyles.AllowHexSpecifier)
    printfn $"{strValue.Sign * int byteValue} ({Convert.ToString(byteValue, 2)}) And {mask} ({Convert.ToString(mask, 2)}) = {(strValue.Sign &&& (int mask |> sign)) * int (byteValue &&& mask)} ({Convert.ToString(byteValue &&& mask, 2)})"

// The example displays the following output:
//       -15 (1111) And 20 (10100) = 4 (100)
//       123 (1111011) And 20 (10100) = 16 (10000)
//       245 (11110101) And 20 (10100) = 20 (10100)
Imports System.Collections.Generic
Imports System.Globalization

Public Structure ByteString
   Public Value As String
   Public Sign As Integer
End Structure

Module Example
   Public Sub Main()
      Dim values() As ByteString = CreateArray(-15, 123, 245)
      
      Dim mask As Byte = &h14        ' Mask all bits but 2 and 4.
      
      For Each strValue As ByteString In values
         Dim byteValue As Byte = Byte.Parse(strValue.Value, NumberStyles.AllowHexSpecifier)
         Console.WriteLine("{0} ({1}) And {2} ({3}) = {4} ({5})", _ 
                           strValue.Sign * byteValue, _ 
                           Convert.ToString(byteValue, 2), _
                           mask, Convert.ToString(mask, 2), _
                           (strValue.Sign And Math.Sign(mask)) * (byteValue And mask), _
                           Convert.ToString(byteValue And mask, 2))
      Next         
   End Sub
   
   Private Function CreateArray(ParamArray values() As Object) As ByteString()
      Dim byteStrings As New List(Of ByteString)
      For Each value As Object In values
         Dim temp As New ByteString()
         Dim sign As Integer = Math.Sign(value)
         temp.Sign = sign
         ' Change two's complement to magnitude-only representation.
         value = value * sign

         temp.Value = Convert.ToString(value, 16)
         byteStrings.Add(temp)
      Next
      Return byteStrings.ToArray()
   End Function   
End Module
' The example displays the following output:
'       -15 (1111) And 20 (10100) = 4 (100)
'       123 (1111011) And 20 (10100) = 16 (10000)
'       245 (11110101) And 20 (10100) = 20 (10100)

필드

MaxValue

Byte의 가능한 최대값을 나타냅니다. 이 필드는 상수입니다.

MinValue

Byte의 최소값을 나타냅니다. 이 필드는 상수입니다.

메서드

CompareTo(Byte)

이 인스턴스를 지정된 8비트 부호 없는 정수와 비교하여 상대 값의 표시를 반환합니다.

CompareTo(Object)

이 인스턴스를 지정된 개체와 비교하여 상대 값의 표시를 반환합니다.

Equals(Byte)

이 인스턴스의 값과 지정된 Byte 개체의 값이 같은지를 나타내는 값을 반환합니다.

Equals(Object)

이 인스턴스가 지정된 개체와 같은지를 표시하는 값을 반환합니다.

GetHashCode()

이 인스턴스의 해시 코드를 반환합니다.

GetTypeCode()

TypeCode 값 형식에 대한 Byte를 반환합니다.

Parse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider)

지정된 스타일 및 문화권별 형식으로 된 숫자의 범위 표현을 해당하는 Byte(으)로 변환합니다.

Parse(String)

숫자의 문자열 표현을 해당하는 Byte로 변환합니다.

Parse(String, IFormatProvider)

숫자를 지정된 문화권별 형식으로 나타낸 문자열 표현을 해당 Byte로 변환합니다.

Parse(String, NumberStyles)

숫자를 지정된 스타일로 나타낸 문자열 표현을 해당 Byte로 변환합니다.

Parse(String, NumberStyles, IFormatProvider)

지정된 스타일 및 문화권별 형식으로 된 숫자의 문자열 표현을 해당하는 Byte로 변환합니다.

ToString()

현재 Byte 개체의 값을 해당하는 문자열 표현으로 변환합니다.

ToString(IFormatProvider)

지정된 문화권별 형식 지정 정보를 사용하여 현재 Byte 개체의 숫자 값을 해당하는 문자열 표현으로 변환합니다.

ToString(String)

지정된 형식을 사용하여 현재 Byte 개체의 값을 해당하는 문자열 표현으로 변환합니다.

ToString(String, IFormatProvider)

지정된 형식 및 문화권별 형식 지정 정보를 사용하여 현재 Byte 개체의 값을 해당 문자열 표현으로 변환합니다.

TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider)

현재 8비트의 부호 없는 정수 인스턴스의 값 형식을 제공된 문자 범위로 지정하려고 시도합니다.

TryParse(ReadOnlySpan<Char>, Byte)

숫자의 범위 표현을 해당하는 Byte로 변환하고, 변환이 성공했는지를 나타내는 값을 반환하도록 시도합니다.

TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, Byte)

지정된 스타일 및 문화권별 형식으로 된 숫자의 범위 표현을 해당하는 Byte(으)로 변환합니다. 반환 값은 변환이 성공했는지 아니면 실패했는지를 나타냅니다.

TryParse(String, Byte)

숫자의 문자열 표현을 해당 Byte로 변환하고, 변환에 성공했는지를 나타내는 값을 반환합니다.

TryParse(String, NumberStyles, IFormatProvider, Byte)

지정된 스타일 및 문화권별 형식으로 된 숫자의 문자열 표현을 해당하는 Byte로 변환합니다. 반환 값은 변환이 성공했는지 아니면 실패했는지를 나타냅니다.

명시적 인터페이스 구현

IComparable.CompareTo(Object)

현재 인스턴스와 동일한 형식의 다른 개체를 비교하고 정렬 순서에서 현재 인스턴스의 위치가 다른 개체보다 앞인지, 뒤인지 또는 동일한지를 나타내는 정수를 반환합니다.

IConvertible.GetTypeCode()

이 인스턴스에 대한 TypeCode를 반환합니다.

IConvertible.ToBoolean(IFormatProvider)

이 멤버에 대한 설명은 ToBoolean(IFormatProvider)를 참조하세요.

IConvertible.ToByte(IFormatProvider)

이 멤버에 대한 설명은 ToByte(IFormatProvider)를 참조하세요.

IConvertible.ToChar(IFormatProvider)

이 멤버에 대한 설명은 ToChar(IFormatProvider)를 참조하세요.

IConvertible.ToDateTime(IFormatProvider)

이 변환은 지원되지 않습니다. 이 메서드를 사용하려고 하면 InvalidCastException이 throw됩니다.

IConvertible.ToDecimal(IFormatProvider)

이 멤버에 대한 설명은 ToDecimal(IFormatProvider)를 참조하세요.

IConvertible.ToDouble(IFormatProvider)

이 멤버에 대한 설명은 ToDouble(IFormatProvider)를 참조하세요.

IConvertible.ToInt16(IFormatProvider)

이 멤버에 대한 설명은 ToInt16(IFormatProvider)를 참조하세요.

IConvertible.ToInt32(IFormatProvider)

이 멤버에 대한 설명은 ToInt32(IFormatProvider)를 참조하세요.

IConvertible.ToInt64(IFormatProvider)

이 멤버에 대한 설명은 ToInt64(IFormatProvider)를 참조하세요.

IConvertible.ToSByte(IFormatProvider)

이 멤버에 대한 설명은 ToSByte(IFormatProvider)를 참조하세요.

IConvertible.ToSingle(IFormatProvider)

이 멤버에 대한 설명은 ToSingle(IFormatProvider)를 참조하세요.

IConvertible.ToType(Type, IFormatProvider)

이 멤버에 대한 설명은 ToType(Type, IFormatProvider)를 참조하세요.

IConvertible.ToUInt16(IFormatProvider)

이 멤버에 대한 설명은 ToUInt16(IFormatProvider)를 참조하세요.

IConvertible.ToUInt32(IFormatProvider)

이 멤버에 대한 설명은 ToUInt32(IFormatProvider)를 참조하세요.

IConvertible.ToUInt64(IFormatProvider)

이 멤버에 대한 설명은 ToUInt64(IFormatProvider)를 참조하세요.

적용 대상

스레드 보안

이 형식의 모든 멤버는 스레드로부터 안전 합니다. 인스턴스 상태를 수정 하는 것 처럼 보이는 멤버는 실제로 새 값으로 초기화 된 새 인스턴스를 반환 합니다. 다른 형식과 마찬가지로이 형식의 인스턴스를 포함 하는 공유 변수에 대 한 읽기 및 쓰기는 스레드 안전을 보장 하기 위해 잠금으로 보호 되어야 합니다.

추가 정보