Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marek-safar/ba4c1a7a7087d77a9341d8ff36515493 to your computer and use it in GitHub Desktop.
Save marek-safar/ba4c1a7a7087d77a9341d8ff36515493 to your computer and use it in GitHub Desktop.
IEnumerator<ConstructorInfo> e = typeInfo.DeclaredConstructors.GetEnumerator();
do {
ConstructorInfo constructorInfo = e.Current();
if (!constructorInfo.IsStatic && constructorInfo.GetParameters.Length() == 0) {
inst = constructorInfo.Invoke(null);
break;
}
} while (e.MoveNext())
inst = Activator.CreateInstance (type);
.... (cast)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment