C#语法求解?
static Activity CreateWorkflow() {
Variable<int> numberBells = new Variable<int>()
{
Name = "numberBells",
Default = DateTime.Now.Hour
};
Variable<int> counter = new Variable<int>()
{
Name = "counter",
Default = 1
};
return new Sequence()
{
DisplayName = "Main Sequence",
Variables = { numberBells, counter },
...
}
}
Variables 为Sequence类的属性成员,声明如下:
public Collection<Variable> Variables { get; }
这不是只读属性吗?上面例子中的Sequence的构造函数中给成员Variables 赋值不懂?求解