Here is a small snippet from a C# program to generate dictionary from file.
var _mappings = File.ReadAllLines("file.txt")
.Select(line =>
{
var splitt = line.Split(new char[] { ' ' },
StringSplitOptions.RemoveEmptyEntries);
return new fooclass
{
foo = abc[0],
foo1 = abc[1],
foo2 = abc[2],
};
})
.ToDictionary<fooclass, string>(mkey => mkey.abc[0]);
I am in a dilemma that on how to return this dictionary from the function. Returning weak types is not considered good in function, and var itself cannot be a return type.
So, what would be ideal in such a case?
If it’s any helpful, the following compiles.