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
Kunjahamed P
NA
376
41.4k
How to getting its own class name(Class and List obejct)
Aug 12 2020 5:33 AM
If I have a class called sample, is there a way(Common) of retrieving "sample" as a string?
public
class
sample
{
public
int
MyProperty {
get
;
set
; }
public
int
MyProperty2 {
get
;
set
; }
public
string
MyProperty3 {
get
;
set
; }
}
sample sampleClass =
new
sample();
List<sample> sampleClassList =
new
List<sample>();
var name = sampleClass.GetType().Name;
var name2 = sampleClassList.GetType().Name;
In here class object class name correct but list object not get. is there any common way to get class name of object (List and Class)
Reply
Answers (
3
)
Any one can conert this query in linq
OOP main concepts