CKTIS / C#
comments and documentation: odniesienie praktyczne
comments and documentation: odniesienie praktyczne: Komentarze są ignorowane przez wykonanie i opisują zamiar, kontrakt lub przyczynę decyzji.
Wersja: C# language and .NET 10 reference runtime
Składnia
// commentsKomentarze są ignorowane przez wykonanie i opisują zamiar, kontrakt lub przyczynę decyzji.
Komentuj dlaczego, szczególnie nietrywialne ograniczenia i ryzyka.
Komentarz powtarzający kod szybko się dezaktualizuje i może wprowadzać w błąd.
Komentarze XML mają składnię i mogą być walidowane przez kompilator.
Kompletny program rzeczywiście używa comments and documentation; oczekiwany stdout to dokładnie comments do not execute.
Przykłady
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");
Wynik
comments do not execute
Kompletny program rzeczywiście używa `comments and documentation`; oczekiwany stdout to dokładnie `comments do not execute`.