Home > Net >  Novice wants to write a delegate, uncertain parameter type, how to write
Novice wants to write a delegate, uncertain parameter type, how to write

Time:01-17

Such as me to write a generic insert data,

Thinking like this:

Public delegate int insertData (parameters);//this parameter types may be int can also be customized type (model)

Each table has its own model, so this parameter is the type is not fixed, that the entrusted the cords when
how do I write?
Thanks to people

CodePudding user response:

You can use the Object, or a generic,

CodePudding user response:

Recommended to use generics.

CodePudding user response:

Thank you, is a generic type is more in line with my ideas, have seen before, but always can't understand his grammar, by this & lt;> Scared, today finally understood a little!

CodePudding user response:

Some things, not to use it, it is difficult to learn, a need to use, feels like hang up and open to the net friend is awake, immediately second understand!

CodePudding user response:

Can use system comes with a return parameter directly entrusted Func<>
  •  Tags:  
  • C#
  • Related