Friends I have read few articles in Web and came to know that by default , function parameters are value type in c#. Is there any way I can validate this?
Please suggest a piece of code or any web reference.
Friends I have read few articles in Web and came to know that by default , function parameters are value type in c#. Is there any way I can validate this?
Please suggest a piece of code or any web reference.
Types in c# can be value or reference types.So while passing the parameter you can pass it as say just variable(value type) or reference type using out,array,ref keywords.
//Value type
sum(a,b);
//reference type
sum(out a,out b);
In simple words reference changes are reflected throughout the scope of the variable but for value types its within function scope. To conclude,if you don't specify the kind of parameter (default) then they are value types else based on the kind say out or ref ,they are reference types.