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
purusingh
NA
1
0
Generic type as string name
Nov 9 2010 2:09 PM
I don't know how to phrase my question.
I have Calss with Generic type.
I.E.
<Code>
public calss EntMgr<T> where T: EntityObject
{
public T Get() {
return context.CreateQuery(typeof(T).Name).ToList<T>();
}
}
</Code>
Now in I want to use that class from another class where I pass the Generectype as a string Value.
I.e.
<Code>
public class Proxy{
public EntityObject Get(string entityObject)
{
Type type = Type.GetType(entityObject);
EntMgr<type> emr = new EntMgr<type>();
emr.get();
}
</Code>
This doesn't work .
Is there a way to do something like that?
I know it is possible to work with "Activator"
But it creates unnecessary object.
Reply
Answers (
1
)
Api Creation
problem overriding connection string from web.config file