"Constants in C# are best defined as static members" #41677
Labels
doc-enhancement
Improve the current content [org][type][category]
dotnet-csharp/svc
help wanted
Good for community contributors to help [up-for-grabs]
lang-reference/subsvc
Pri1
High priority, do before Pri2 and Pri3
Type of issue
Other (describe below)
Description
This article includes this Note:
Shouldn't this say that constants in C# are best defined with the
const
keyword? Using static members has different implications for the application, since static members are resolved at runtime and are not necessarily read-only. For primitive values,const
in C# is much closer to the behavior of#define
in C/C++, since both are resolved at compile time.Page URL
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives
Content source URL
https://github.com/dotnet/docs/blob/main/docs/csharp/language-reference/preprocessor-directives.md
Document Version Independent Id
501be68d-5ad0-18d9-8958-54215bb57fc0
Article author
@BillWagner
Metadata
The text was updated successfully, but these errors were encountered: