【发布时间】:2020-02-21 07:50:43
【问题描述】:
如果在创建新类的代码中启动了初始列表,有人可以解释我将如何在 C# 类构造函数中添加 GENERATED 通知。 Notifications = notificationsPASSEDList 是否只在构造函数之后运行?
//.. get list of notifications to pass
var myClass = new MyClass { Notifications = notificationsPASSEDList }
public class MyClass {
public List<NotificationsClass> Notifications;
public MyClass () {
// .. get list of generated notifications
Notifications.AddRange(notificationsGENERATEDList)
}
}
【问题讨论】:
-
试试看吧!