>What's the simplest way to initialize a type, given its Type object?
Are you looking for
System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor() ?
Mattias

Signature
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Ole Nielsby - 17 May 2006 16:11 GMT
> Are you looking for
> System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor() ?
Yes - though I'm not quite happy with what I see. Seems a bit
weird or low-level to use a handle. The docs state nothing about
what will happen if the type has already been run, so I think I'll
just stick with using reflection to access a static field of the classes
instead - which will do the job in my case.
But thanks for the hint anyway - I didn't figure CompilerServices would
be the place to look.
Ole N.