TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
357
120.5k
Piece of code analysis
Mar 1 2012 2:15 PM
Hi,
Id like to know what this piece of code is doing please. My comments are next to each expression as to what I think is happening.
// Resetting the generic type T and assigning to a local variable t
T t =
default
(T);
// Assigning the ExecuteReader method to a local variable named reader in order to get the result of the command.
var
reader = command.ExecuteReader();
// Whilst the reader variable is reading the rows.
if
(reader.Read())
// Pass the reader variable to the make method and assign it to t.
t = make(reader);
// return the value type t.
return
t;
This is the Method signature declaration
public static T ReadList<T>(Func<IDataReader, T> make)
Reply
Answers (
3
)
Understanding what a particular method is doing?
What is a global cache assembly