I am getting a datatype in code as "int32" however, what I actually need is the full name, "integer". Is this possible?
Here's the code for the data type:
public static List<Parameter> GetParameterMembers(Type parameterType)
{
var parameterList = new List<Parameter>();
var returnTypeFields = parameterType.IsArray ? ((TypeInfo)parameterType.GetElementType()).DeclaredFields : ((TypeInfo)parameterType).DeclaredFields;
returnTypeFields.ToList().ForEach(item =>
{
if (item.MemberType != MemberTypes.Field) return;
parameterList.Add(new Parameter
{
Name = item.Name,
Parameters = item.FieldType.IsClass && !IsNativeType(((FieldInfo)item).FieldType) ? GetParameterMembers(((FieldInfo)item).FieldType) : new List<Parameter>(),
DataType = item.FieldType.Name
});
});
return parameterList;
}
Aucun commentaire:
Enregistrer un commentaire