How to refer to a method’s return type within the method itself?

For example, is it possible to refer to GetNames within the code below, and avoid having to using a second list within the method? I believe such a thing is possible in VB.NET – does C# support it as well?

public List<string> GetNames() { List<string> GetMyNames = new List<string>(); . . // code to populate GetMyNames . return GetMyNames; } 

by MasterClown via /r/csharp

Leave a Reply