@@ -57,15 +57,16 @@ namespace IRaCIS.Core.Infrastructure.Extention
|
||||
}
|
||||
|
||||
Type type = obj.GetType();
|
||||
PropertyInfo[] properties = type.GetProperties();
|
||||
PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
|
||||
|
||||
Dictionary<string, object> dictionary = new Dictionary<string, object>();
|
||||
|
||||
foreach (PropertyInfo property in properties)
|
||||
{
|
||||
string propertyName = property.Name;
|
||||
Console.WriteLine(propertyName);
|
||||
object propertyValue = property.GetValue(obj);
|
||||
|
||||
Console.WriteLine(propertyName);
|
||||
// 如果属性的类型是枚举,将其值保留为整数
|
||||
if (property.PropertyType.IsEnum || (Nullable.GetUnderlyingType(property.PropertyType)?.IsEnum == true && propertyValue!=null) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user