0
如何訪問屬性,我也跟着TSL documentation on attributes並創建了兩個類:從亞型
[GraphNode]
cell struct Fruit
{
string color;
}
[GraphNode, BaseType : Fruit]
cell struct Apple
{
string variety;
}
我用這樣生成的代碼:
Apple apple = new Apple();
Console.WriteLine(apple.variety);
Console.WriteLine(apple.color);
的代碼可以訪問variety
場,但不能訪問color
字段:
'Apple'不包含'co lor'並且沒有可以找到接受'Apple'類型的第一個參數的擴展方法'color'(您是否缺少使用指令或程序集引用?)
如何訪問繼承屬性?
是否有任何方法可以正確地爲一個單元格子類型,或者我應該將所需的屬性(例如'string')複製到每個子類? –
這是我與你分享的一個願望。但據我所知,你不能繼承。我也是用拷貝來做的。 –