开发者

Error: "; expected", can't find where I'm missing it

I'm using a public partial class to extend some LINQ开发者_如何学运维 TO SQL Classes, and am getting the aforementioned error for my [first attempt] at adding a weird property, not sure if I'm doing it right. :S

In any case, code follows:

public partial class Round
{
    public int PlayersInRound
    {
        get { return this.RoundMembers.Count(); }
    }

    public bool PlayerIsInRound(string sUsername)
    {
        get { return ((from x in this._RoundMembers where x.Member.Email == sUsername select x).Count() >= 1); }
    }
}

The VS IDE gives a red underline to the "{" on the third-to-last line, and I'm not sure why. The first added one seems to work fine, but I'm not entirely sure it does as I haven't built enough of the site yet, nor do I really know how to do TDD as of yet. :P

Thanks a ton, guys! :)


Your error is in the PlayerIsInRound: You are mixing a method with a property

remove the get{}

public bool PlayerIsInRound(string sUsername)
{
    return ((from x in this._RoundMembers where x.Member.Email == sUsername select x).Count() >= 1);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜