草庐IT

ProtectedPassword

全部标签

c# - 在 .NET 2.0 中序列化私有(private)支持数据成员?

我正在编写一个小的xml配置文件,该文件将从特定位置保存和加载(因此不使用user.config)。我的应用程序是.NET2.0,无法移动到较新的版本(因此没有DataContractSerializer)我需要实现“保存密码”选项,以便在用户使用该应用程序。目前我是这样做的publicclassUserSettings{//Snipmanyotherproperties...publicboolSavePassword{get;set;}[XmlIgnore]publicstringPassword{get{stringretVal=string.Empty;if(Protected