Created
July 15, 2019 09:58
-
-
Save Kir-Antipov/89f2ecb9d0e2a43cffe5f2f615882381 to your computer and use it in GitHub Desktop.
How to create an object of type void
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
public class MyVoid | |
{ | |
public static readonly MyVoid Instance = new MyVoid(); | |
private MyVoid() | |
{ | |
unsafe | |
{ | |
MyVoid it = this; | |
TypedReference typedReference = __makeref(it); | |
IntPtr* pointer = (IntPtr*)(**(IntPtr**)&typedReference).ToPointer(); | |
pointer[0] = typeof(void).TypeHandle.Value; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment