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 7510195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:09:25+00:00 2026-05-29T23:09:25+00:00

Short question: is there a way to access the datatypes available in .net application

  • 0

Short question: is there a way to access the datatypes available in .net application as a group (and hence query them with LINQ). Like this …

Dim myType = from l in myapplication.availabledatatypes where l.name="name of type I want" select l

Longer explanation:
I’m trying to move lots of old records from tables into identical ‘archive’ tables with Linq to SQL. As a part of that process, I need to select records from the live table and convert them to the (identical) archive type. I’m trying to do this cleanly with a single method that can be used for all the different table/archive table pairs by using reflection, following this excellent guide
http://michaelmerrell.com/2010/08/converting-a-linq-object-to-a-similar-object/

My conversion method will take an input of type object and convert it to an output of type object, which I then plan to cast to the required output type in the method that calls the converting method. I am able to get the property of datacontext which has the same name as the type I want to convert to, but I can’t seem to programatically pull the type with the same name.

Dim typeIamLookingFor as propertyInfo= from l in mydatacontext.getproperties where l.name.contains("archive") and l.name.contains(input.gettype.name) select l

How do I pick, from the types available in my namespace, the one whose name equals that of typeIamLookingFor. Obviously .getType returns the type PropertyInfo, but what I really want is the type with the name = typeiamlookingfor.name

Edit
Thanks for suggestions. Type.GetType gets me closer, but compiler now saying Object Must Implement IConvertible. I am going to investigate this different error and accept this answer.

Dim output as object
Dim typeName as string = "namespace." & inputObject.gettype.name & "_Archive"
output = output = Convert.ChangeType(output, Type.GetType(typeName))  //generates error: Object Must Implement IConvertible
  • 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-29T23:09:27+00:00Added an answer on May 29, 2026 at 11:09 pm

    I think you are over-complicating your solution. Based on your description, you probably just need Type.GetType():

    Type typeIamLookingFor = Type.GetType("archive." + typeName)
    

    Is there more to it?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Short question: is there a way to make a jsonp request to a server,
Short version question : Is there navigator.mozIsLocallyAvailable equivalent function that works on all browsers,
The short question, is there an off the self function to make a graph
Short question: Is the parent of an entity group included in that entity group
In short: is there some way I can modify a class definition such that
Short version: Is there a simple, built-in way to identify the calling view in
This is sort of a follow-up to this question . If there are multiple
Short question: Do any of MS's built in Data Objects support INotifyPropertyChanged? Long explination:
Short question - how do you define your view models? Here are some of
Short question: Is it possible to do a redirection, say when a user isn't

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.