EN CSharp Directive Pragma - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Management of diagnostics
warning disable/restore changes the selected warnings. checksum specifies the checksum for the debug information of the generated source.
Simple example (Example.cs)
Save this example separately as Example.cs. Run it independently of the other examples on this page.
Example.cs:
// PROJECT-EXAMPLE
#pragma warning disable CS0168
int unused;
#pragma warning restore CS0168
System.Console.WriteLine("Ready");
Result:
Ready
Syntax
#pragma warning disable CODE / restore CODE
Example 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)
{
#pragma warning disable CS0168
int unused;
#pragma warning restore CS0168
Console.WriteLine("Ready");
}
}
Example 2
#pragma checksum "Generated.cs" "{8829d00f-11b8-4213-878b-770e8597ac16}" "00112233445566778899AABBCCDDEEFF"
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)
{
Console.WriteLine("Source mapped");
}
}
Official source: Microsoft Learn.