CKTIS / C#
namespace: riferimento pratico
namespace: riferimento pratico: namespace raggruppa nomi ed evita collisioni senza creare un oggetto runtime.
Versione: C# language; verified against C# 14 reference
Sintassi
namespace /* grammar-specific form */namespace raggruppa nomi ed evita collisioni senza creare un oggetto runtime.
Usalo coerentemente con i confini del dominio e la API public.
Un namespace non è un confine di accesso né un modulo di distribuzione.
Le forme file-scoped e block-scoped non si possono mescolare liberamente nello stesso file.
Il programma completo usa realmente namespace; lo stdout esatto atteso è 4.
Esempi
using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Number = System.Int32;
Console.WriteLine(new Demo.Value().Number);
namespace Demo { sealed class Value { public int Number => 4; } }
Risultato
4
Il programma completo usa realmente `namespace`; lo stdout esatto atteso è `4`.