Skip to content

Commit 5bdc2ba

Browse files
bkoelmanbart-degreed
authored andcommitted
Changed guidance to prefer int.Parse() over Int32.Parse(). (dennisdoomen#223)
Co-authored-by: bart-degreed <bart@degreed.com>
1 parent 176d52b commit 5bdc2ba

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

_rules/2201.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ rule_category: dotnet-framework-usage
44
title: Use C# type aliases instead of the types from the `System` namespace
55
severity: 1
66
---
7-
For instance, use `object` instead of `Object`, `string` instead of `String`, and `int` instead of `Int32`. These aliases have been introduced to make the primitive types first class citizens of the C# language, so use them accordingly.
7+
For instance, use `object` instead of `Object`, `string` instead of `String`, and `int` instead of `Int32`. These aliases have been introduced to make the primitive types first class citizens of the C# language, so use them accordingly. When referring to static members of those types, use `int.Parse()` instead of `Int32.Parse()`.
88

9-
**Exception:** When referring to static members of those types, it is custom to use the full CLS name, e.g. `Int32.Parse()` instead of `int.Parse()`. The same applies to members that need to specify the type they return, e.g. `ReadInt32`, `GetUInt16`.
9+
**Exception:** For interop with other languages, it is custom to use the [CLS-compliant name](https://docs.microsoft.com/en-us/dotnet/standard/common-type-system) in type and member signatures, e.g. `HexToInt32Converter`, `GetUInt16`.

0 commit comments

Comments
 (0)