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

  • Home
  • SEARCH
  • 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 517113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:48:03+00:00 2026-05-13T07:48:03+00:00

I’m working on a T4 template to automatically generate a C# class definition from

  • 0

I’m working on a T4 template to automatically generate a C# class definition from an XML file. For each element in the XML document I’d like to determine the type of the content in that element. Is there a framework class that handles automatically determining a type from a string value?

  • 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-13T07:48:03+00:00Added an answer on May 13, 2026 at 7:48 am

    That is a very interesting question but I am afraid you are going to have a tough time finding anything in the FCL that will do this.

    If you think about it, your problem is a rather unique one, you have a known type as a conversion source and an unknown output type. This doesn’t come up too often in day-to-day coding using a framework like .NET.

    Since the .NET framework is designed to be used with strongly-typed languages, types are very important and most of the time we know what type we want and can request a conversion from some generic source (like a string or an object) to that specific type. That is why we have casting, conversion methods (like Convert.ToInt32 and such), and similar things. They are all designed to allow us to directly state the output type of the conversion since we know what it is that we want to get.

    All that being said, I would be interested to see if someone else has written something like this because the parsing that would be involved in getting this to work must be very similar to the C# compiler itself in the way that literal values are handled in source code.

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

Sidebar

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.