# C#'s other spellings — System. names, Int32,

> The spellings a pasted C# file is full of compile with C#'s meaning. A System.-qualified name is the type Osy# has (System.Math is Math), global:: is the global namespace every name already resolves from, Int32/String/Decimal are the types int/string/decimal alias, #region/#pragma/#nullable are inert, #if keeps the branch whose symbols are defined, and global using imports into every file of the app.

<!-- id: function-csharp-spellings · area: function · stability: stable · html: https://osysharp.com/reference/function/csharp-spellings/ -->

## Summary        {#summary}
A C# file you paste carries spellings that name nothing new — a namespace prefix, a BCL type name, a `#region`. Each
compiles here **with the meaning C# gives it**:

| Written | Means | Why |
|---|---|---|
| `System.Math.Max(2, 3)`, `System.Text.StringBuilder` | `Math.Max(2, 3)`, `StringBuilder` | those types are Osy#'s own and always in scope, as with `using System;` |
| `global::System.Math.Abs(-3)` | `Math.Abs(-3)` | every name already resolves from the global namespace |
| `Int32`, `Int64`, `String`, `Decimal`, `Double`, `Boolean`, `Char`, `Byte` | `int`, `long`, `string`, `decimal`, `double`, `bool`, `char`, `byte` | the keyword is C#'s alias for exactly that type |
| `#region` / `#endregion`, `#pragma`, `#nullable`, `#warning` | nothing | they fold an outline or tune C#'s own warnings |
| `#define X` … `#if X` … `#endif` | the branch whose condition holds | C#'s conditional compilation, over the file's symbols |
| `global using X;` | `using X;` in every file | C# 10's project-wide import |

## Signature      {#signature}
```osy syntax
int Bigger(int a, int b) => System.Math.Max(a, b);   // System.Math IS Math
Int32 Count;                                         // Int32 IS int
#region Helpers … #endregion                         // inert
#if DEBUG … #elif TRACE … #else … #endif             // C#'s conditional compilation
global using Shop;                                   // an import every file sees
```

## Description    {#description}

### Which `System.` names compile?   {#system-prefix}
A name qualified by a .NET namespace whose types Osy# provides — `System`, `System.Collections.Generic`, `System.Linq`,
`System.Text`, `System.Text.Json`, `System.Text.RegularExpressions`, `System.Threading.Tasks`, `System.Net` — is the
type itself. `global::` in front changes nothing either.

```osy title="the qualified names are the types Osy# has" test app=function-csharp-spellings
int Bigger(int a, int b) { return System.Math.Max(a, b); }
int Distance(int a) { return global::System.Math.Abs(a); }
string Joined() {
  var sb = new System.Text.StringBuilder();
  var parts = new System.Collections.Generic.List<string> { "a", "b" };
  foreach (var p in parts) { sb.Append(p); }
  return sb.ToString() + System.String.Empty;
}
```

A namespace Osy# does not provide keeps its qualification and is refused by that namespace — `System.IO.Path` answers
*"`System.IO.Path` is from a .NET namespace Osy# does not provide"*, and `System.Threading.*` adds that there are no
threads to lock ([[function-csharp-exclusions#threads]]).

### What do `Int32` and `String` mean here?   {#bcl-aliases}
The type their keyword names. `Int32` is `int` in a signature, a local, a property, a generic argument, a cast and as
the receiver of a static (`Int32.Parse`):

```osy title="the BCL names of the keyword types" test app=function-csharp-spellings
entity Rate { Decimal Value; Int32 Count; Boolean Live; }

Int64 Scaled(Int32 x) { return (Int64)x * Int32.Parse("3"); }
decimal Sum() {
  Decimal d = 1.5m; Int32 i = 2; String s = "ab"; Boolean b = true;
  return d + i + s.Length + (b ? 1 : 0);   // 6.5, as in C#
}
```

`Object` is not on the list: `object` is a type keyword Osy# leaves out, and the refusal says so by name.

### Which preprocessor directives work?   {#preprocessor}
All of C#'s, at the start of a line. `#region`/`#endregion`, `#pragma` (warning and checksum alike), `#nullable` and
`#warning` change nothing about what the program means, so they are accepted and ignored. `#error text` stops the
compile with its text. `#line` is refused: it renumbers the file for a code generator, and every diagnostic here points
at the source as written. A `#` line that is no directive — `# a comment` — is refused by name; a comment is `//`.

```osy title="inert directives" test app=function-csharp-spellings
#region Helpers
#pragma warning disable CS0168
int One() { return 1; }
#pragma warning restore CS0168
#endregion
```

### What does `#if` test?   {#conditional}
The symbols this FILE defines with `#define` (and removes with `#undef`), written before its first line of code, as C#
requires — combined with `!`, `&&`, `||`, `==`, `!=`, parentheses, `true` and `false` — and the platform's feature
symbols, which every file has (C#'s `NET8_0_OR_GREATER`): `OSY_ACTOR_PRINCIPAL_IDS` on a platform with
`Actor.PrincipalIds()`. A platform older than a symbol does not define it, so a kit that must still compile there keeps
the old code in the `#else`. A branch that is not taken is not read at all, so it need not be valid Osy#:

```osy title="the branch whose symbols are defined" test app=function-csharp-spellings
#define FAST
#if FAST && !SLOW
int Mode() { return 1; }
#elif SLOW
int Mode() { return 2; }
#else
anything at all — this branch is never read
#endif
```

### What does `global using` do?   {#global-using}
The same import as `using X;`, in force in **every** file of the app instead of only its own — C# 10's meaning. For a
`System.*` namespace it changes nothing (those types are always in scope); for one of the app's own namespaces or a
capability, a file with no `using` of its own sees it.

```osy title="an import every file sees" test app=function-csharp-spellings
global using System.Text;

string Greeting() { return new StringBuilder().Append("g").ToString(); }
```

`global using static T;` and a `global using A = T;` alias are refused by name: those two forms hold for the file they
are written in, so write them without `global` in each file that needs them.

## See also       {#see-also}
- [The C# Osy# leaves out — and why](https://osysharp.com/reference/function/csharp-exclusions/) — what Osy# leaves out on purpose, each refused by name with its reason
- [use](https://osysharp.com/reference/types/use/) — `use` and `using`, and which `using System.…` lines compile unchanged
- [function](https://osysharp.com/reference/function/declaration/) — what a function is
