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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:49:50+00:00 2026-05-20T01:49:50+00:00

I could easily write one, but I’m wondering if there is already a standard

  • 0

I could easily write one, but I’m wondering if there is already a standard string deserialization interface or pattern somewhere in the framework that creates/populates an object based on a string.

Basically I’m looking to do the opposite of ToString(). Every object supports ToString(), which is handy, but it would be nice if I could go the other way, and actually (re)create an object from that string. Obviously this isn’t possible for all objects, but that’s fine.

I looked at ISerializable but it’s silly complicated (having SerializationInfos and StreamingContexts and all sorts of nonsense) for something that should be a core feature, imo. I’m envisioning something like this:

public interface IDeserializable {
    void Deserialize( string data );
}

Upon further thought, it would be nice (and be more symmetric to ToString) if I could actually pass the string to a constructor, but I wouldn’t be able to use an interface to represent this. I’d have to use reflection on the type and check for a constructor that accepts a single string, and use reflection to instantiate it.

  • 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-20T01:49:50+00:00Added an answer on May 20, 2026 at 1:49 am

    As a reflection/Type- friendly alternative to TryParse:

    var conv = TypeDescriptor.GetConverter(type);
    object value = conv.ConvertFromInvariantString(s);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a script (could of course easily write one , but maybe there's
I've tried looking at similar problems, but could not easily find one that helped
I want to use a custom class that could handle querying easily. Are there
Does anyone knows a java library that could easily encode java Maps into json
I generally work with dataframes and could easily do this for a data frame
Whats the recommended way for storing authentication information in iOS that could be easily
Is it possible in VB.NET to easily write an event handler that will handle
There are cases when one needs a memory efficient to store lots of objects.
I'm trying to get my head round Unit Testing and there's one more piece
I've been wondering about how hard it would be to write some Python code

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.