Įvykiai
Kurti DI programėles ir agentus
03-17 21 - 03-21 10
Prisijunkite prie meetup serijos, kad sukurtumėte keičiamo dydžio DI sprendimus, pagrįstus realaus pasaulio naudojimo atvejais, su kolegomis kūrėjais ir ekspertais.
Registruotis dabarŠi naršyklė nebepalaikoma.
Atnaujinkite į „Microsoft Edge“, kad pasinaudotumėte naujausiomis funkcijomis, saugos naujinimais ir techniniu palaikymu.
Property | Value |
---|---|
Rule ID | IDE0211 |
Title | Convert to 'Program.Main' style program |
Category | Style |
Subcategory | Language rules (code-block preferences) |
Applicable languages | C# 9+ |
Options | csharp_style_prefer_top_level_statements |
This rule flags the use of top-level statements instead of a Main
method entry point in a project.
Options specify the behavior that you want the rule to enforce. For information about configuring options, see Option format.
Property | Value | Description |
---|---|---|
Option name | csharp_style_prefer_top_level_statements | |
Option values | true |
Disables the rule. |
false |
Prefer Program.Main style program. |
|
Default option value | true |
// Code with violations (entire file).
Console.WriteLine("Hello world.");
// Fixed code.
internal class Program
{
private static void Main(string[] args)
{
Console.WriteLine("Hello world.");
}
}
If you want to suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the rule.
#pragma warning disable IDE0211
// The code that's violating the rule is on this line.
#pragma warning restore IDE0211
To disable the rule for a file, folder, or project, set its severity to none
in the configuration file.
[*.{cs,vb}]
dotnet_diagnostic.IDE0211.severity = none
To disable all of the code-style rules, set the severity for the category Style
to none
in the configuration file.
[*.{cs,vb}]
dotnet_analyzer_diagnostic.category-Style.severity = none
For more information, see How to suppress code analysis warnings.
.NET atsiliepimas
.NET yra atvirojo kodo projektas. Pasirinkite saitą, kad pateiktumėte atsiliepimą:
Įvykiai
Kurti DI programėles ir agentus
03-17 21 - 03-21 10
Prisijunkite prie meetup serijos, kad sukurtumėte keičiamo dydžio DI sprendimus, pagrįstus realaus pasaulio naudojimo atvejais, su kolegomis kūrėjais ir ekspertais.
Registruotis dabar