What is the use of in keyword?
C# 7.0 introduce new keyword which is in. Let's share usability of this new keyword.
What is the use of in keyword?
C# 7.0 introduce new keyword which is in. Let's share usability of this new keyword.
C# 7 introduced the in modifier. It got the name by being the opposite of out keyword. It makes the reference (alias) read only; and the caller does have to initialize the value.
void DoSomeTask(in Employee emp)
{
//emp can't be altered here.
}
It helps to restrict make any modification in object accidentally.