Tutorial by Examples

You can return an anonymous object from your function public static object FunctionWithUnknowReturnValues () { /// anonymous object return new { a = 1, b = 2 }; } And assign the result to a dynamic object and read the values in it. /// dynamic object dynamic x = FunctionWithUnknowR...
You can return an instance of Tuple class from your function with two template parameters as Tuple<string, MyClass>: public Tuple<string, MyClass> FunctionWith2ReturnValues () { return Tuple.Create("abc", new MyClass()); } And read the values like below: Console.Wri...
The ref keyword is used to pass an Argument as Reference. out will do the same as ref but it does not require an assigned value by the caller prior to calling the function. Ref Parameter :-If you want to pass a variable as ref parameter then you need to initialize it before you pass it as ref param...

Page 1 of 1