any equivalent to VB.net function name as return value in C#?
- by user1179861
In vb.net there is a weird approach that you can use the function name as the result variable..
example:
Function Foo(ByVal bar As Integer) As List(Of Integer)
Foo = New List(Of Integer)
Foo.Add(bar + 1)
End Function
As far as i know, in C# you have to:
List<int> foo(int bar)
{
var result = new List<int>();
result.Add(bar + 1);
return result;
}
I'm not sure if it's by design or i just don't know the right way to do this..
Please enlight me!
Thanks in advance,
Eitan.