1.泛形方法:具體實例點擊查看BuilderResultList 2.調用 ...
1.泛形方法:具體實例點擊查看BuilderResultList
/// <summary> /// 實例化泛形對象並賦值 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="Entity"></param> private static void Builder<T>(T Entity) where T : class, new() { T newEntity = new T(); var newEntityType = newEntity.GetType(); newEntityType.GetProperty("屬性名").SetValue(newEntity, "屬性值"); }
2.調用
Builder(new UserDto());