Skip to content

Instantly share code, notes, and snippets.

@yanickrochon
Created November 28, 2013 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yanickrochon/7692139 to your computer and use it in GitHub Desktop.
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#.
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