You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: standard/expressions.md
-2Lines changed: 0 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -291,8 +291,6 @@ When overload resolution rules ([§12.6.4](expressions.md#1264-overload-resoluti
291
291
292
292
> *Example*: For the operation `b * s`, where `b` is a `byte` and `s` is a `short`, overload resolution selects `operator *(int, int)` as the best operator. Thus, the effect is that `b` and `s` are converted to `int`, and the type of the result is `int`. Likewise, for the operation `i * d`, where `i` is an `int` and `d` is a `double`, `overload` resolution selects `operator *(double, double)` as the best operator. *end example*
293
293
294
-
There are no predefined operators for dealing with native integer ([§8.3.6](types.md#836-integral-types)). Instead, `nint` and `nuint` values shall be promoted to `long` and `ulong`, respectively, and the resulting corresponding predefined operators used instead.
Copy file name to clipboardExpand all lines: standard/lexical-structure.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -664,7 +664,9 @@ The type of a *boolean_literal* is `bool`.
664
664
665
665
#### 6.4.5.3 Integer literals
666
666
667
-
Integer literals are used to write values of types `int`, `uint`, `long`, and `ulong`. (There is no way to write values of type `nint` and `nuint`. Instead, implicit or explicit casts of other integral constant values may be used.) Integer literals have three possible forms: decimal, hexadecimal, and binary.
667
+
Integer literals are used to write values of types `int`, `uint`, `long`, and `ulong`. Integer literals have three possible forms: decimal, hexadecimal, and binary.
668
+
669
+
> *Note:* There is no way to write literal values of type `nint` and `nuint`. Instead, implicit or explicit casts of other integral constant values may be used. *end note*
Copy file name to clipboardExpand all lines: standard/types.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -319,9 +319,9 @@ Every simple type has members. Each simple type that is an alias for a predefine
319
319
>
320
320
> *endnote*.
321
321
322
-
Although `nint` and `nuint` shallberepresentedbythetypes `System.IntPtr` and `System.UIntPtr`, respectively, `nint` and `nuint` are *not* aliasesforthosetypes. Assuch, notallmembersofthecorresponding `System` typesaredefinedfor `nint` and `nuint`. Instead, thecompilershallmakeavailableadditionalconversionsandoperationsforthetypes `System.IntPtr` and `System.UIntPtr` whenusedinthecontextofnativeintegertypes.
322
+
Although `nint` and `nuint` shallberepresentedbythetypes `System.IntPtr` and `System.UIntPtr`, respectively, `nint` and `nuint` are *not* aliasesforthosetypes. Assuch, notallmembersofthecorresponding `System` typesaredefinedfor `nint` and `nuint`. Instead, thecompilershallmakeavailableadditionalconversions, unaryoperators (§12.9) andarithmeticoperators (§12.12)forthetypes `System.IntPtr` and `System.UIntPtr` whenusedinthecontextofnativeintegertypes.
323
323
324
-
Whiletheimplementationprovidesoperationsandconversionsfor `nint` and `nuint` thatareappropriateforintegertypes, thoseoperationsandconversionsarenotavailableonthe `System` typecounterparts. Forexample,
324
+
Whilethelanguageprovidesoperationsandconversionsfor `nint` and `nuint` thatareappropriateforintegertypes, thoseoperationsandconversionsarenotavailableonthe `System` typecounterparts. Forexample,
@@ -362,14 +362,16 @@ public string ToString(string format);
362
362
363
363
Interfaces implemented by `System.IntPtr` and `System.UIntPtr` are implicitly included in `nint` and `nuint`, with occurrences of the underlying types replaced by the corresponding native integer types. For example, if `IntPtr` implements `ISerializable`, `IEquatable<IntPtr>`, and `IComparable<IntPtr>`, then `nint` implements `ISerializable`, `IEquatable<nint>`, and `IComparable<nint>`.
364
364
365
+
`typeof(nint)` is `typeof(System.IntPtr)`, and `typeof(nuint)` is `typeof(System.UIntPtr)`.
366
+
367
+
<!-- The following three paragraphs can be deleted for C# 10 -->
368
+
365
369
`nint` and `System.IntPtr`, and `nuint` and `System.UIntPtr`, are considered equivalent for overriding, hiding, and implementing, however.
366
370
367
371
Overloads cannot differ by `nint` and `System.IntPtr`, and `nuint` and `System.UIntPtr`, alone. However, overrides and implementations may differ by `nint` and `System.IntPtr`, or `nuint` and `System.UIntPtr`, alone.
368
372
369
373
Methods hide other methods that differ by `nint` and `System.IntPtr`, or `nuint` and `System.UIntPtr`, alone.
370
374
371
-
`typeof(nint)` is `typeof(System.IntPtr)`, and `typeof(nuint)` is `typeof(System.UIntPtr)`.
372
-
373
375
### 8.3.6 Integral types
374
376
375
377
C# supports the following integral types, with the sizes and value ranges, as shown:
0 commit comments