diff --git a/csharp_fundamentals/5_working_with_reference_types_and_value_types.md b/csharp_fundamentals/5_working_with_reference_types_and_value_types.md index eb3a918..57fc012 100644 --- a/csharp_fundamentals/5_working_with_reference_types_and_value_types.md +++ b/csharp_fundamentals/5_working_with_reference_types_and_value_types.md @@ -78,4 +78,20 @@ To **Pass-parameter-by-reference**, use `ref/out param` in both function definit } ``` -Not very often use. \ No newline at end of file +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) \ No newline at end of file