C# how to invoke a field initializer using reflection?
问题 Say I have this C# class public class MyClass { int a; int[] b = new int[6]; } Now say I discover this class using reflection and while looking at the fields I find that one of them is of type Array (ie: b) foreach( FieldInfo fieldinfo in classType.GetFields() ) { if( fieldInfo.FieldType.IsArray ) { int arraySize = ?; ... } } I know it's not guaranteed that the array has a field initializer that creates the array but if it does I would like to know the size of the array created by the field