开发者

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

开发者 https://www.devze.com 2023-02-04 20:26 出处:网络
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

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

精彩评论

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