BitConverter.IsLittleEndian 字段
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指示数据存储在此计算机体系结构中的字节顺序(“endianness”)。
public: static initonly bool IsLittleEndian;
public static readonly bool IsLittleEndian;
staticval mutable IsLittleEndian : bool
Public Shared ReadOnly IsLittleEndian As Boolean
下面的代码示例演示如何使用 IsLittleEndian
字段。
// Example of the BitConverter::IsLittleEndian field.
using namespace System;
int main()
{
Console::WriteLine( "This example of the BitConverter::IsLittleEndian field "
"generates \nthe following output when run on "
"x86-class computers.\n" );
Console::WriteLine( "IsLittleEndian: {0}", BitConverter::IsLittleEndian );
}
/*
This example of the BitConverter::IsLittleEndian field generates
the following output when run on x86-class computers.
IsLittleEndian: True
*/
// Example of the BitConverter.IsLittleEndian field.
using System;
class LittleEndDemo
{
public static void Main( )
{
Console.WriteLine(
"This example of the BitConverter.IsLittleEndian field " +
"generates \nthe following output when run on " +
"x86-class computers.\n");
Console.WriteLine( "IsLittleEndian: {0}",
BitConverter.IsLittleEndian );
}
}
/*
This example of the BitConverter.IsLittleEndian field generates
the following output when run on x86-class computers.
IsLittleEndian: True
*/
open System
printfn $"This example of the BitConverter.IsLittleEndian field generates \nthe following output when run on x86-class computers.\n"
printfn $"IsLittleEndian: {BitConverter.IsLittleEndian}"
// This example of the BitConverter.IsLittleEndian field generates
// the following output when run on x86-class computers.
//
// IsLittleEndian: True
' Example of the BitConverter.IsLittleEndian field.
Module LittleEndDemo
Sub Main( )
Console.WriteLine( _
"This example of the BitConverter.IsLittleEndian " & _
"field generates " & vbCrLf & "the following output " & _
"when run on x86-class computers." & vbCrLf )
Console.WriteLine( "IsLittleEndian: {0}", _
BitConverter.IsLittleEndian )
End Sub
End Module
' This example of the BitConverter.IsLittleEndian field generates
' the following output when run on x86-class computers.
'
' IsLittleEndian: True
不同的计算机体系结构使用不同的字节顺序存储数据。 “Big-endian”表示最重要的字节位于单词的左端。 “Little-endian”表示最重要的字节位于单词的右端。
备注
通过将 16 位、32 位或 64 位整数IPAddress.HostToNetworkOrder传递给 方法,可以从网络字节顺序转换为主机计算机的字节顺序,而无需检索字段的值BitConverter.IsLittleEndian。
产品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |