Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 584145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:52:02+00:00 2026-05-13T14:52:02+00:00

How would I create a type while knowing just the name of the type

  • 0

How would I create a type while knowing just the name of the type in string form example…

My aspx contains this and some bindable control

<asp:EntityDataSource ID="EntityDataSource1" runat="server" 
        ConnectionString="name=MyEntities" DefaultContainerName="MyEntities" 
        EntitySetName="MyData">
    </asp:EntityDataSource>

Now from code I need to be able to create an instance of EntitySetName=”MyData”. Keep in mind I will not know these names until runtime tho. I can do EntityDataSource1.EntitySetName and this gives me the name in string form. But now I need to create and instance of it and get access to the members so I can manipulate the data. I have been trying Activator.CreateInstance and used various overloaded versions of it. Bottom line tho is I am not seeing how to do this. I keep running into trying to cast something into a type when all I have is the name of the type. Any pointers to any info to help me understand this would be much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:52:02+00:00Added an answer on May 13, 2026 at 2:52 pm

    How about:

    var entity = Activator.CreateInstance(Type.GetType("namespaceofyourtype.MyData, assemblynameofyourtype"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to create a page that contains just a textarea and placeholder
I would like to create a strongly type list and decide the type in
How would I create the equivalent Linq To Objects query? SELECT MIN(CASE WHEN p.type
I would like to create an object of Generics Type in java. Please suggest
I would like to create a custom data type which basically behaves like an
I would like to create a function that will return list of type that
How does the code looks that would create an object of class: string myClass
I would like to create a C# WPF form that collects measurements of equipment,
I need to create some pretty big tables in SQL Server 2008. While I
I am using this SELECT name FROM sqlite_master WHERE type = table AND name

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.