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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:39:54+00:00 2026-05-25T18:39:54+00:00

Other then the speed issues when accessing and hashtable and casting value types, is

  • 0

Other then the speed issues when accessing and hashtable and casting value types, is this really very bad?

[Serializable]
public class Cheat : ISerializable
{
    public Cheat() { }

    public string Orange { get { return Convert.ToString(_mData["Orange"]); } set { _mData["Orange"] = value; } }

    public List<int> Ints { get { return (List<int>)(_mData["Ints"]); } set { _mData["Ints"] = value; } }

    #region ISerializable Members

    protected Hashtable _mData = new Hashtable();

    protected Cheat(SerializationInfo info, StreamingContext context)
    {
        _mData = (Hashtable)info.GetValue("_mData", typeof(Hashtable));
    }

    void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
    {
        info.AddValue("_mData", _mData);
    }

    #endregion
}
  • 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-25T18:39:55+00:00Added an answer on May 25, 2026 at 6:39 pm

    By using the ISerializable interface for serialisation you are essentially taking control over the serialisation process. This allows you full control over handing versioning of serialised model classes. So you could even deserialise to a completely different class if you wanted to. Given the example above, serialisation into a Hashtable does not add value.

    As you have pointed out it decreases speed because you have to unbox the objects for each property request. If you have lots of property reads then this could really add up.

    A hashtable scenario like this would be best used when you had to pass immutable types like string up several layers to a calling method. In that case leaving the properties boxed may be of some benefit. However because your _mData field is protected and you are specifically exposing properties with types of List<int> and string then I assume you do not intend to do this.
    If you wanted to continue your model you should at the very least cache your properties as strongly typed fields and covert type only once on first read.

    Specially relating to versioning, if you expect the model to be updated in the future or have a definite need for compatibility allow for that now so that model versions can be identified. Previously when I have done this I have used a marker field (or XML attribute for XML serialisation) with a version number.

    My suggestion would be to just serialise and deserialise to the types you need. If you version your class latter then allow for compatibility in you protected constructor and GetObjectData method.

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

Sidebar

Related Questions

Does anyone know of a really good editor to debug JavaScript (other then Visual
I know, nobr tag is deprecated, then how can i do this with other
Some issues with the Flash Bone Tool are described very well in this YouTube
I have a DBAdmin class that connects to the database, and then some other
The app will run fine, then crash - literally every other time. It seems
I opened up Business Intelligence Design Studio (BIDS) the other day. Since then my
I had issues with debugging some very complex integration test in our application. The
1. TIMING in a game: Is there a way to use other then System.Currentmillis()-starttime>XX
This should not create any Issues with the NDA as I am not asking
Other than self.class.send :method, args... , of course. I'd like to make a rather

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.