-3
我有一個小但很難理解這行代碼如下:事件簽名
types(lstTypes[i].AvailableDatatype);
我不知道什麼是AvailableDatatype的目的。
這裏的全部代碼...
namespace ConsoleApplicationTest
{
class Program
{
static void Main(string[] args)
{
List<DotNet> lstTypes = new List<DotNet>();
DotNet bltypes = new DotNet();
bltypes.AvailableDatatype = "bool";
lstTypes.Add(bltypes);
DotNet strTypes = new DotNet();
strTypes.AvailableDatatype = "string";
lstTypes.Add(strTypes);
DotNet intTypes = new DotNet();
intTypes.AvailableDatatype = "int";
lstTypes.Add(intTypes);
DotNet decTypes = new DotNet();
decTypes.AvailableDatatype = "decimal";
lstTypes.Add(decTypes);
types += x =>
{
Console.WriteLine(x);
Console.ReadLine();
};
for (int i = 0; i <= lstTypes.Count - 1; i++)
{
types(lstTypes[i].AvailableDatatype);
}
}
static event Action<string> types;
}
public class DotNet
{
public string AvailableDatatype { get; set; }
}
}
@LarsTech好點,謝謝 – stuartd