Yes , you can return multiple values in a single method using TUPLE
Yes ,You can return multiple values in a single method using ref/out keywords
No it is not. You can return an object though and that object can contain multiple properties –
Yes it is possible by using TUPLE.
Yes. Simplest way is to use 'Tuple'. Which was introduced in C# 4.0Prior to the introduction of tuples in .NET, there were three common ways to do so. Out parameters Class or struct types Anonymous types returned through a dynamic return type
You can achieve with a workaround. By definition method return one value. # You can use out parameter and Tuples. The newly introduced in c#.
Yes, using Out Parameter, which is used when you want a method to return more than one values.int Total = 0, Product = 0; SimpleMethod(10, 20, out Total, out Product); Console.WriteLine("Sum = {0}, Product = {1}", Total, Product); public static void SimpleMethod(int FN, int SN, out int Sum, out int Product) {Sum = FN + SN;Product = FN * SN; }
We can return multiple values from a function using the following 3 approaches:Reference parametersOutput parametersReturning an ArrayReturning an object of class/struct typeReturning a Tuple
No, a method cannot return more than one values. You can use other techniques. If you want to get more than one value from a method then you can simply change the return to a custom or object type