I am querying a SQL database via LINQ in my C# project and returning the data to a var type variable
How can I overload a method with var type? example of what I am trying to do:
public decimal[][] method(var nameOfVar){}
If this cannot be done, what is an alternative?
I am querying a SQL database via LINQ in my C# project and returning the data to a var type variable
The type of the variable isn't var
- that's just the form of declaration you're using. The type of the variable is whatever the compiler infers it to be.
How can I overload a method with var type?
You can't. var
isn't a type.
Unfortunately, we don't know what you're trying to do in method
. Maybe you want to make it a generic method. Maybe you want to make it take object
. If you're actually trying to use an anonymous type, and pass values between methods, then you're probably best off creating a named type with the relevant properties.
See more on this question at Stackoverflow