Skip to content

Language or BCL data types #13976

Closed
Closed

Description

I'm not sure it's worth to discuss this issue. To ensure consistency within the code base the preferred data types should be noted in the wiki. I know this can be a sensitive and subjective issue...
Only use BCL data types

String text;
String.IsNullOrEmpty(text);
Double number;
Double.TryParse(text, out number);

Only use language data types

string text;
string.IsNullOrEmpty(text);
double number;
double.TryParse(text, out number);

Use language data types for declarations | BCL data types for calling members

string text;
String.IsNullOrEmpty(text);
double number;
Double.TryParse(text, out number);

My favorit is the last option because

  • an Enum can't inherit from UInt32 so you have to use uint
  • because it's not obvious that data types have members
  • MSDN says "√ DO use a generic CLR type name, rather than a language-specific name, in the rare cases when an identifier has no semantic meaning beyond its type."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions