.net - What alternative approach could be used in C# to avoid method returning `object` type? -
i know method returning list<string> @ moment. in (which occur quite in our application) scenarios, returns list having only one string.
so return either string or list<string>.
since it's unpredictable it'll return @ run time, @ present it's return type kept object.
what alternative approach used avoid method returning object?
edit: have answer question what alternative approach used avoid method returning object? ; without considering scenario described. list enough here.
why return string? list<string> single string in perfectly defined... use that! ambiguous api silly here.
another option might ienumerable<string>, but... meh, return list single string!
Comments
Post a Comment