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
Amin Soraya
NA
11
2.2k
how get list of data of T variable
Oct 21 2018 8:14 AM
hi there
how to send a list of specific class to such method:
public
static
DataTable SetPropertyToDataTable<T>(T dataList,Type _class) where T :
class
{
Dictionary<
string
,
object
> columns =
new
Dictionary<
string
,
object
>();
var properties =_class.GetProperties();
foreach
(var item
in
dataList)
foreach
(var property
in
properties)
{
var name = property.Name;
var value = property.GetValue(item,
null
);
if
(!columns.ContainsKey(name))
columns.Add(name, value);
}
return
ImportPropertyAndValues(columns);
}
I mean T datalist
Reply
Answers (
1
)
Generate a PDF programatically
Add row in datagrid after select from SQL C#