Is it possible for a method to accept any type?
For example can I write:
public ActionResult Edit(? vp){
}
where ActionResult
would accept an Integer, float, or any other (possibly custom) type?
Is it possible for a method to accept any type?
For example can I write:
public ActionResult Edit(? vp){
}
where ActionResult
would accept an Integer, float, or any other (possibly custom) type?
You could use
object
and then write a custom model binder for it by overriding the BindModel method which will decide what value to returned based on the request.Your method can accept an object like so:
if i understand your meaning so you can use generic like that:
T represent the type you want, and whan you call the method give the type in the <>
or you can use object type like this:
hope it helped you!