C# tips and tricks 5 - Difference between const, readonly and static variables

Описание к видео C# tips and tricks 5 - Difference between const, readonly and static variables

C# tips and tricks :
Difference between const, readonly and static variables

const keyword :
A variable declared as const must be assigned a value at declaration.
And we can not change its value once it is assigned.
They are implicitly static by default.
You can apply const keyword to built-in value types (byte, short, int, long, char, float, double, decimal, bool), enum, a string literal, or a reference type which can be assigned with a value null.

readonly keyword:
The value will be initialized either at declaration time or in the constructor.

 Read only values will evaluate at runtime only.

static keyword:
static variables are common to all the objects.
Each static variable is shared among all the objects of the same class.
and they do not tied to a specific object.

ankpro
ankpro training
Asp.net MVC
C#
C sharp
Bangalore
Rajajinagar
Selenium
Coded UI
Mobile automation testing
Mobile testing
JQuery
JavaScript
.Net
C
C++
Components of the .Net framework
Hello World
Literal
Keywords
Variable
Data types
Operators
Branching
Loops
Arrays
Strings
Structures
Enums
Functions

Комментарии

Информация по комментариям в разработке