本文整理匯總了C#中System.Type.IsExplicitLayout屬性的典型用法代碼示例。如果您正苦於以下問題:C# Type.IsExplicitLayout屬性的具體用法?C# Type.IsExplicitLayout怎麽用?C# Type.IsExplicitLayout使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Type
的用法示例。
在下文中一共展示了Type.IsExplicitLayout屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Main
//引入命名空間
using System;
using System.Reflection;
using System.ComponentModel;
using System.Runtime.InteropServices;
// Class to test for the ExplicitLayout property.
[StructLayout(LayoutKind.Explicit, Size=16, CharSet=CharSet.Ansi)]
public class MySystemTime
{
[FieldOffset(0)]public ushort wYear;
[FieldOffset(2)]public ushort wMonth;
[FieldOffset(4)]public ushort wDayOfWeek;
[FieldOffset(6)]public ushort wDay;
[FieldOffset(8)]public ushort wHour;
[FieldOffset(10)]public ushort wMinute;
[FieldOffset(12)]public ushort wSecond;
[FieldOffset(14)]public ushort wMilliseconds;
}
public class Program
{
public static void Main(string[] args)
{
// Create an instance of the type using the GetType method.
Type t = typeof(MySystemTime);
// Get and display the IsExplicitLayout property.
Console.WriteLine("\nIsExplicitLayout for MySystemTime is {0}.",
t.IsExplicitLayout);
}
}