|
Dieser Artikel wurde maschinell übersetzt. Bewegen Sie den Mauszeiger über die Sätze im Artikel, um den Originaltext anzuzeigen. Weitere Informationen
|
Übersetzung
Original
|
StructLayoutAttribute-Klasse
Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)
Der StructLayoutAttribute-Typ macht die folgenden Member verfügbar.
| Name | Beschreibung | |
|---|---|---|
![]() | StructLayoutAttribute(Int16) | |
![]() ![]() ![]() ![]() | StructLayoutAttribute(LayoutKind) |
| Name | Beschreibung | |
|---|---|---|
![]() | TypeId | |
![]() ![]() ![]() | Value |
| Name | Beschreibung | |
|---|---|---|
![]() ![]() ![]() ![]() | Equals | Infrastruktur. |
![]() ![]() ![]() ![]() | GetHashCode | |
![]() ![]() ![]() ![]() | GetType | |
![]() | IsDefaultAttribute | |
![]() ![]() | Match | |
![]() ![]() ![]() ![]() | ToString |
| Name | Beschreibung | |
|---|---|---|
![]() ![]() ![]() ![]() | CharSet | |
![]() ![]() ![]() | Pack | |
![]() ![]() ![]() ![]() | Size |
| Name | Beschreibung | |
|---|---|---|
![]() ![]() | _Attribute.GetIDsOfNames | |
![]() ![]() | _Attribute.GetTypeInfo | |
![]() ![]() | _Attribute.GetTypeInfoCount | |
![]() ![]() | _Attribute.Invoke |
using System; using System.Runtime.InteropServices; namespace InteropSample { [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; } class LibWrapper { [DllImport("kernel32.dll")] public static extern void GetSystemTime([MarshalAs(UnmanagedType.LPStruct)]MySystemTime st); }; class TestApplication { public static void Main() { try { MySystemTime sysTime = new MySystemTime(); LibWrapper.GetSystemTime(sysTime); Console.WriteLine("The System time is {0}/{1}/{2} {3}:{4}:{5}", sysTime.wDay, sysTime.wMonth, sysTime.wYear, sysTime.wHour, sysTime.wMinute, sysTime.wSecond); } catch(TypeLoadException e) { Console.WriteLine("TypeLoadException : " + e.Message); } catch(Exception e) { Console.WriteLine("Exception : " + e.Message); } } } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core-Rolle wird nicht unterstützt), Windows Server 2008 R2 (Server Core-Rolle wird mit SP1 oder höher unterstützt; Itanium wird nicht unterstützt)
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.


