Guest User

Guest User

  • Tech Writer
  • 357
  • 106.7k

Generics and Delegates

Feb 1 2012 1:40 PM
Hi 

Can anyone be so kind to explain (step by step) the below peice of code I stumbled across

public static List<T> ReadList<T>(string procedure, Func<IDataReader>, T>

make, object[] params = null)


Ive never seen anything like this using generics <T> and Func<> delegates in

this way?

From my understanding of the below method name ReadList<T> which returns a

generic List<T> when invoked, ReadList needs to be implemented with a

specific closed type instead of <T> and accepts 4 input parameters, the

first of type string, the second a datareader, the third a make, and fourth

a list of objects that return null?

Brought to you by: JavaScript SDK for Bold BI dashboard and analytics embedding. Free trial.

Answers (5)