Click here to Skip to main content
15,887,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
problem
How to use dynamic datatype on more than one key GetByID repository pattern ?
public T GetById(int Id)
        {
            return dbSet.Find(Id);
        }

and in interface Igenerics

 T GetById(int Id)

actually i need

T GetById(int Id,key2,key3,...etc)


What I have tried:

How to use more than one parameters
<pre>T GetById(int Id,key2,key3,...etc)

and how to call it on controller
Posted
Updated 9-Feb-19 4:17am

1 solution

Use the "params" keyword in your method signature to pass a variable number of parameters.

params keyword - C# Reference | Microsoft Docs[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900