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
L A
NA
170
171.2k
Get all members (Props, fields) of a class, with in a class
May 15 2018 2:00 AM
Hi,
I'm looking for an efficient way to get all properties/ fields of complex type which internally have Properties of another complex type.
class
A
{
public
int
Id{
get
;
set
;}
public
string
Name{
get
;
set
;}
public
List<
string
> Branch{
get
;
set
;}
public
BuildData build {
get
;
set
;}
public
SampleData sample {
get
;
set
;}
public
DummyData dData {
get
;
set
}
//constructor
public
A(){}
}
class
BuildData{
private
string
_buildData;
public
string
param1{
get
;
set
;}
public
string
[] paramArgs{
get
;
set
;}
}
class
SampleData {
public
string
Test{
get
;
set
;}
public
List<DummyData> dummyArgs{
get
;
set
;}
}
class
DummyData {
public
int
Val{
get
;
set
;}
public
string
GUIData{
get
;
set
;}
}
I have to use class A & get all its members (fields, Props) which should also include members of other complex types such as DummyData, BuildData, SampleData.
I tried using Reflection but couldn't get all members. Followed this article (https://www.c-sharpcorner.com/UploadFile/ff2f08/deep-copy-of-object-in-C-Sharp/) - but couldn't achieve it.
Reply
Answers (
1
)
WART whats application password generating
Can we route css and js file in asp.net mvc?