next add the namespace. you will notice that i have defined a two level namespace. this is great when you are building a class library with many different classes.
namespace continuum.threading
{
the postqueuedcompletionstatus and getqueuedcompletionstats win32 api methods both require a pointer to the win32 overlapped structure. because this structure will be used by the unsafe win32 api call, we need to make sure the structure is aligned exactly the same way it would be in our c++ applications. this can be accomplished by using the structlayout attribute. by setting the attribute to “layoutkind.sequential”, the structure will be aligned based on the same rules as the c++ compiler.
the structure requires members that are pointers. the only way to add pointers to this structure is to use the unsafe keyword. we can still use the fcl types when defining the structure. this is very important because we can make sure the structure is identical to the c++ version.
// structures
//=============================================================================
/// <summary> this is the win32 overlapped structure </summary>
[structlayout(layoutkind.sequential, charset=charset.auto)]
public unsafe struct overlapped
{
uint32* ulpinternal;
uint32* ulpinternalhigh;
int32 loffset;
int32 loffsethigh;
uint32 hevent;
}