private PropertyModel[] GeneratePropertyModels(ITypeSymbol typeSymbol) { var classInformation = new ClassInformation(typeSymbol); List <IFieldSymbol> fields = classInformation.GetFields().ToList(); List <IPropertySymbol> properties = classInformation.GetProperties().ToList(); PropertyModel[] propertyModels = new PropertyModel[fields.Count + properties.Count]; for (int i = 0; i < fields.Count; i++) { propertyModels[i] = new PropertyModel() { Name = fields[i].Name, Type = TypeName(fields[i].Type), Visibility = GetAccessibilityName(fields[i].DeclaredAccessibility) }; } for (int i = 0; i < properties.Count; i++) { propertyModels[fields.Count + i] = new PropertyModel() { Name = properties[i].Name, Type = TypeName(properties[i].Type), Visibility = GetAccessibilityName(properties[i].DeclaredAccessibility) }; } return(propertyModels); }
private MethodModel[] GenerateMethodModels(ITypeSymbol typeSymbol) { var classInformation = new ClassInformation(typeSymbol); List <IMethodSymbol> methods = classInformation.GetMethods().ToList(); MethodModel[] methodModels = new MethodModel[methods.Count]; for (int i = 0; i < methods.Count; i++) { methodModels[i] = new MethodModel() { Name = methods[i].Name, Parameters = GeneratePrameterModels(methods[i]), Visibility = GetAccessibilityName(methods[i].DeclaredAccessibility), Type = TypeName(methods[i].ReturnType) }; } return(methodModels); }