private MirrorCommonInfo GetMirrorInfo(Mirror mirror) { MirrorCommonInfo info = null; //var methodMirror = mirror as MethodMirror; var propertyMirror = mirror as PropertyInfoMirror; var fieldMirror = mirror as FieldInfoMirror; var parameterMirror = mirror as ParameterInfoMirror; var localMirror = mirror as LocalVariable; var objectMirror = mirror as ObjectMirror; //if (methodMirror != null) //{ // childInfo = new PropertyChildInfo(); // childInfo.Name = methodMirror.Name; // childInfo.FullName = methodMirror.FullName; //} //else if (propertyMirror != null) { info = new MirrorCommonInfo(); info.Name = propertyMirror.Name; info.FullName = propertyMirror.PropertyType.FullName; info.Type = propertyMirror.PropertyType; } else if (fieldMirror != null) { info = new MirrorCommonInfo(); info.Name = fieldMirror.Name; info.FullName = fieldMirror.FieldType.FullName; info.Type = fieldMirror.FieldType; } else if (parameterMirror != null) { info = new MirrorCommonInfo(); info.Name = parameterMirror.Name; info.FullName = parameterMirror.ParameterType.FullName; info.Type = parameterMirror.ParameterType; } else if (localMirror != null) { info = new MirrorCommonInfo(); info.Name = localMirror.Name; info.FullName = localMirror.Type.FullName; info.Type = localMirror.Type; } else if (objectMirror != null) { info = new MirrorCommonInfo(); info.Name = "#ObjectMirror#-UNKNOWN-NAME"; info.FullName = objectMirror.Type.FullName; info.Type = objectMirror.Type; } return(info); }
private bool IsExpandable(MirrorCommonInfo info) { return(info != null && (info.Type.IsArray || !info.Type.IsPrimitive)); }