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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:40:18+00:00 2026-05-26T18:40:18+00:00

for deserialization I use working method: public static bool InvokeDeserializeMethod<T>(ref T o, string serializedObject)

  • 0

for deserialization I use working method:

public static bool InvokeDeserializeMethod<T>(ref T o, string serializedObject)
        {
            Type[] typesParameters = new Type[]{typeof(string)};
            MethodInfo methodInfo = typeof(o).GetMethod("Deserialize",typesParameters);
            object[] deserializeMethodParameters = new string [] {serializedObject};
            if (methodInfo != null)
            {
                try
                {
                    o = (T)methodInfo.Invoke(o, deserializeMethodParameters);
                    return true;
                }
                catch
                {
                    return false;
                }
            }
            return false;
        }

Now I am making copy, paste functions, and I need to deserialize some serialized objects(strings)
I cant use this method, because I dont wanna send ref on some existing object, I new object to be created
It would be the best If I have a method like:

public static T InvokeDeserializeMethod<T>(string serializedObject)

Is there any way how to achieve it, return object of type T, without having existing object which I would send to method? (Every object I will use with this method contains serialize and deserialize method)
Thanks!

  • 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-26T18:40:19+00:00Added an answer on May 26, 2026 at 6:40 pm

    You can use either one of the Activator.CreateInstance method overloads to create a instance of a known type, if you know it’s constructor arguments, or FormatterServices.GetUninitializedObject(Type t) if you don’t want to invoke the types constructor on deserialization.

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

Sidebar

Related Questions

I use Serialization/DeSerialization Technique. BinaryFormatter class. Each time when new assembly is created the
I am writing a deserialization method that converts xml to a Java object. I
I'm trying to use the native flex serialization/deserialization process to save/load state of a
a few weeks ago I started to use xsd.exe for create classes for serialization/deserialization
For example I want to know how to use Python pickle serialization & deserialization.
I want to use a custom aplified type (think Nullable) in a DataContract class.
In JSON, when the client sends a numeric data type(with decimlas), what deserialization class
I recently converted some Silverlight 3 WCF services to use the new binary http
The title sums it up. The project I am currently working on doesn't use
What are the possibilities in Android, when I intend to use serialization/deserialization with data?

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.