About 7,710,000 results
Open links in new tab
  1. Constants - C# | Microsoft Learn

    Constants are immutable values which are known at compile time and do not change for the life of the program. Constants are declared with the const modifier. Only the C# built-in types may be …

  2. Is there anyway to #define CONSTANT on a solution basis?

    Jun 14, 2023 · One can define a constant on a csproject basis, and one can put #define constant in cs file, but I wonder whether one can define it on a vs sln basis? You can actually use a …

  3. How to define constants - C# | Microsoft Learn

    Oct 27, 2021 · Constants are fields whose values are set at compile time and can never be changed. Use constants to provide meaningful names instead of numeric literals ("magic …

  4. The const keyword - C# reference | Microsoft Learn

    Dec 4, 2024 · You use the const keyword to declare a constant field or a local constant. Constant fields and locals aren't variables and can't be modified. Constants can be numbers, Boolean …

  5. .net - C# naming convention for constants? - Stack Overflow

    Oct 28, 2008 · In the new IDE's such as Visual Studio it is easy to identify the types, scope and if they are constant so it is not strictly necessary. The FxCop and Microsoft StyleCop software …

  6. How to define constants in Visual C# like #define in C?

    Nov 29, 2009 · Constants in C# are best defined as static members of a class or struct. If you have several such constants, consider creating a separate "Constants" class to hold them. In …

  7. C# Constants - C# Tutorial

    In C#, a constant holds a value that is known at compile time and does not change during the execution of the program. To define a constant, you use the const keyword with the following …

  8. What is Constants(const) in C#? - C# Corner

    Constants are essential elements in any programming language, providing a way to define values that remain unchanged throughout the execution of a program. This guide explores the …

  9. How to use const, readonly, and static in C# - InfoWorld

    Jun 8, 2020 · The const (read: constant) keyword in C# is used to define a constant variable, i.e., a variable whose value will not change during the lifetime of the program.

  10. C# Constant Variables - W3Schools

    The const keyword is useful when you want a variable to always store the same value, so that others (or yourself) won't mess up your code. An example that is often referred to as a …