Created
November 28, 2013 13:51
-
-
Save yanickrochon/7692139 to your computer and use it in GitHub Desktop.
Example my "issue" with C#'s naming convention. While most modern language have a "camel case" convention, C# uses an "upper camel case" (or "pascal case") convention. This cause problem when translating from, let say, JavaScript (JSON), or XML into C#.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class User { | |
// composed class | |
public enum UserRole { | |
Guest = 0, | |
Subscriber = 1, | |
Supervisor = 2, | |
Editor = 3, | |
Publisher = 4, | |
Administrator = 5 | |
} | |
public int Id { get; set } | |
public string Login { get; set; } | |
// ex: UserRole UserRole.... O_o ... see below... | |
public UserRole UserRole { get; set; } | |
} | |
public static class UserManagement { | |
public static ValidateAdminPrivilege(User user) { | |
return user.UserRole == User.UserRole.Administrator; | |
// ^ Instanc.Property | |
// ^ Class.Enum | |
// -> The only difference is the 'u' for the instance... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment