我有这个错误
Error 3 Cannot apply indexing with [] to an expression of type
我的问题在这里
if (client["banhours"] == 0)
{
client["banhours"] = -1;
client["banreason"] = "Infinite time.";
client["banstamp"] = DateTime.Now.AddYears(100);
}
if (Account.State == Database.AccountTable.AccountState.Banned)
{
if (client["banhours"] != -1)
{
DateTime banStamp = client["banstamp"];
if (DateTime.Now > banStamp.AddDays(((int)client["banhours"]) / 24).AddHours(((int)client["banhours"]) % 24))
Account.State = Database.AccountTable.AccountState.Player;
}
}
客户端是>>> Client.GameClient客户端;
答案 0 :(得分:1)
您是否尝试过client.banhours或client.banreason?
如果Client.GameClient是一个类,它们是属性或字段,则不能像数组或字典那样访问它们。