What is the most efficient way to get the default constructor (i.e. instance constructor with no parameters) of a System.Type?
I was thinking something along the lines of the code below but it seems like there should be a simplier more efficient way to do it.
Type type = typeof(FooBar)
BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
type.GetConstructors(flags)
.Where(constructor => constructor.GetParameters().Length == 0)
.First();