12345678910111213141516171819 |
- using System.Reflection;
- namespace Universal;
- public class Property(string name, Type type, object? value)
- {
- public string Name { get; } = name;
- public Type TypeName { get; } = type;
- public object Value { get; } = value ??= "NULL";
- }
- public class ReflectionHelper
- {
- public static IEnumerable<Property> FromatDitits<T>(T model) where T : notnull
- {
- foreach (PropertyInfo propertyInfo in model.GetType().GetRuntimeProperties())
- yield return new(propertyInfo.Name, propertyInfo.PropertyType, propertyInfo.GetValue(model));
- }
- }
|