forked from naudio/NAudio
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
including missing file from previous commit
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Runtime.InteropServices; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace NAudio.Utils | ||
{ | ||
/// <summary> | ||
/// Support for Marshal Methods in both UWP and .NET 3.5 | ||
/// </summary> | ||
public static class MarshalHelpers | ||
{ | ||
/// <summary> | ||
/// SizeOf a structure | ||
/// </summary> | ||
public static int SizeOf<T>() | ||
{ | ||
return Marshal.SizeOf<T>(); | ||
} | ||
|
||
/// <summary> | ||
/// Offset of a field in a structure | ||
/// </summary> | ||
public static IntPtr OffsetOf<T>(string fieldName) | ||
{ | ||
return Marshal.OffsetOf<T>(fieldName); | ||
} | ||
|
||
/// <summary> | ||
/// Pointer to Structure | ||
/// </summary> | ||
public static T PtrToStructure<T>(IntPtr pointer) | ||
{ | ||
return Marshal.PtrToStructure<T>(pointer); | ||
} | ||
} | ||
} |