-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add IsGroup to PlayerInfo #100
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On principle a unit test for this would be good, however it's trivial enough that it's probably fine.
Oh also this could and probably should be a property rather than a method |
Co-authored-by: BadMagic100 <[email protected]>
Sorry, not familiar enough with the syntax. Would that be something like this? public bool IsGroup { get; set; } = GroupMembers != null && GroupMembers.Length > 0; |
public bool IsGroup => GroupMembers != null && GroupMembers.Length > 0; Above would be the best way to go, read-only property with an expression body syntax |
For educational purposes yours would allow the outside world to set it, and additionally it would be set when the instance is created instead of evaluated on request. The most verbose correct way would be like this with a number of more concise intermediate options. public bool IsGroup
{
get
{
return GroupMembers != null && GroupMembers.Length > 0;
}
} |
I did not test this because I haven't gone through the process of building it before. It looks like the one above it so it probably works fine.