CKTIS / C#
comments and documentation: riferimento pratico
comments and documentation: riferimento pratico: I commenti sono ignorati durante l’esecuzione e descrivono intento, contratto o ragione di una decisione.
Versione: C# language and .NET 10 reference runtime
Sintassi
// commentsI commenti sono ignorati durante l’esecuzione e descrivono intento, contratto o ragione di una decisione.
Commenta il perché, specialmente vincoli e rischi non banali.
Un commento che ripete il codice diventa presto obsoleto e può fuorviare.
I commenti XML hanno una sintassi e possono essere convalidati dal compilatore.
Il programma completo usa realmente comments and documentation; lo stdout esatto atteso è comments do not execute.
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;
// A line comment explains intent.
/* A block comment can span a region. */
Console.WriteLine("comments do not execute");
Risultato
comments do not execute
Il programma completo usa realmente `comments and documentation`; lo stdout esatto atteso è `comments do not execute`.