如何序列化在C#哈希表 [英] how to serialize hashtable in c#

查看:387
本文介绍了如何序列化在C#哈希表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现会话状态模式sqlserver的,当我跑我的应用我面临的哈希表的XML序列化错误。我的班是这样的:

I have implemented session state mode sqlserver and when i run my application i am facing XML serialization error of hash table . and my class looks like:

[Serializable]
    public class ProjectSetup{
    private System.Collections.Hashtable _ConfigTable;
   //and other properties here

   public System.Collections.Hashtable ConfigTable
        {
            get { return _ConfigTable; }
        }

}

现在我想知道如何,序列化hastable或者是否有另一种选择,请让我知道

Now i want to know how to serialize the hastable or if there is another alternative please let me know.

和准确的错误是:无法序列类型System.Collections.Hashtable成员ProjectSetup.ConfigTable,因为它实现IDictionary的

and exactly error is: "Cannot serialize member ProjectSetup.ConfigTable of type System.Collections.Hashtable, because it implements IDictionary"

推荐答案

试试这个:

<一个HREF =http://www.deploymentzone.com/2008/09/19/idictionarytkeytvalue-ixmlserializable-and-lambdas/相对=nofollow> http://www.deploymentzone.com/2008/09/19/ idictionarytkeytvalue-的IXmlSerializable和-lambda表达式/

这篇关于如何序列化在C#哈希表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆