Skip to content

KO CSharp Operator Interpolation

Codex edited this page Oct 11, 2026 · 2 revisions

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

행 형태

핸드북 C# · 실용 가이드

보간은 문자열의 삽입을 계산합니다. 문자 그대로 백슬래시를 유지합니다. raw-literal은 중첩된 따옴표와 여러 줄의 텍스트를 용이하게 합니다.

간단한 예제 (Example.cs)

이 예제를 Example.cs로 따로 저장하고 이 페이지의 다른 예제와 독립적으로 실행하세요.

Example.cs:

// PROJECT-EXAMPLE
int count = 3;
System.Console.WriteLine($"Count={count}");

결과:

Count=3

통사론

$"{value:format}" / @"text" / """text"""

예시 1

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;

public static class Program
{
    public static async Task Main(string[] args)
    {
        decimal amount = 12.5M;
        string text = $"Amount: {amount:F2}";
        Console.WriteLine(text);
        Console.WriteLine(@"C:\Scripts\Data");
    }
}

예시 2

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;

public static class Program
{
    public static async Task Main(string[] args)
    {
        string json = """{"name":"ore","count":3}""";
        Console.WriteLine(json);
    }
}

공식 출처: Microsoft 학습.

Clone this wiki locally