Looking for Reference Types & Value Types & The Special Case of Strings in .NET, repo at 3894e93
parent
30b8444b6d
commit
1b458a4503
@ -78,4 +78,20 @@ To **Pass-parameter-by-reference**, use `ref/out param` in both function definit
|
||||
}
|
||||
```
|
||||
|
||||
Not very often use.
|
||||
Not very often use.
|
||||
|
||||
## Working with Value Types & Value Type Parameters
|
||||
|
||||
Reference:
|
||||
* [Value types (C# reference)](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/value-types)
|
||||
* [Types (C# Programming Guide)](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/types/)
|
||||
|
||||
## Looking for Reference Types & Value Types & The Special Case of Strings in .NET
|
||||
|
||||
Differentiate btw Value & Reference:
|
||||
* When variable is created by `class`, it's Reference type
|
||||
* When variable is created by `struct`, it's Value type
|
||||
|
||||
How to check whether it's reference or value type:
|
||||
* Place cursor in VSCode to type, Press `F12`, we can see metadata for the type. It will show whether it's `struct` or `class`
|
||||
* The only exception is `String`, it's a reference type but often behave like a value type (i.e. passed as value in function by default)
|
Loading…
x
Reference in New Issue
Block a user