惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Microsoft Security Blog
Microsoft Security Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
V
Visual Studio Blog
宝玉的分享
宝玉的分享
IT之家
IT之家
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
I
InfoQ
B
Blog RSS Feed
T
Threatpost
博客园_首页
M
MIT News - Artificial intelligence
Spread Privacy
Spread Privacy
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Know Your Adversary
Know Your Adversary
U
Unit 42
Engineering at Meta
Engineering at Meta
C
Cyber Attacks, Cyber Crime and Cyber Security
月光博客
月光博客
Scott Helme
Scott Helme
T
Tor Project blog
有赞技术团队
有赞技术团队
AWS News Blog
AWS News Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Last Week in AI
Last Week in AI
S
Schneier on Security
Vercel News
Vercel News
博客园 - Franky
C
Cybersecurity and Infrastructure Security Agency CISA
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
L
LangChain Blog
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
The GitHub Blog
The GitHub Blog
雷峰网
雷峰网
Latest news
Latest news
C
CXSECURITY Database RSS Feed - CXSecurity.com
Hugging Face - Blog
Hugging Face - Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
G
GRAHAM CLULEY
S
Security Affairs
A
About on SuperTechFans
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
大猫的无限游戏
大猫的无限游戏
W
WeLiveSecurity
Cisco Talos Blog
Cisco Talos Blog
罗磊的独立博客

博客园 - shawnliu

log4net使用guidline(写的很详细) Log4net 简明手册(来自yuhen,写的非常好) 浅谈大型网站动态应用系统架构 使用cfengine来实现服务器的自动化配置 - shawnliu - 博客园 CodeDOM & Emit & MSIL 如何在.NET中实现脚本引擎 (CodeDom篇) SQL Server中奇妙的NULL 什么是Landing Page? sql server apply与 join等的区别 老是在select中丢掉了NOLOCK有啥后果???deadlock ooo scope_identity(), @@IDENTITY, IDENT_CURRENT()区别 Introduction to SQL SQL Server Indexes [A good reference] 大众点评的年会视频 很搞 十二种标题编写方法,让你流量暴涨[zz] 正则表达式 1个月100万封邮件营销实战及总结[zz] B2C Opinions 年薪12万的乞丐给我上了震撼的一课 Eliminate the Use of Temporary Tables For HUGE Performance Gains
(测试小程序)使用XmlSerializer来连接xml config文件和类
shawnliu · 2010-01-07 · via 博客园 - shawnliu

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Xml.Serialization;

using System.IO;

namespace TestXmlSerializer

{

    public class Program

    {

        static string xml = @"<dbroot enabled=""true"" Name=""gg"">

<server>

www.amazon.com

</server>

<user>ssis</user>

<pwd>ssis@123</pwd>

</dbroot>";

        static void Main(string[] args)

        {

            XmlSerializer serializer = new XmlSerializer(typeof(Database));

            TextReader tr = new StringReader(xml);

            Database db = serializer.Deserialize(tr) as Database;

            TextWriter writer = new StringWriter();

            serializer.Serialize(writer, db);

            Console.WriteLine(writer.ToString());

            Console.ReadLine();

        }

    }

    [Serializable]

    [XmlRoot("dbroot")]

    public class Database

    {

        [XmlAttribute("enabled")]

        public bool Enabled;

        private string name;

        [XmlAttribute("Name")]

        public string Name

        {

            get { return name; }

            set { name = value; }

        }

        [XmlElement("server")]

        public string Server;

        [XmlElement("user")]

        public string User;

        [XmlElement("pwd")]

        public string Pwd;

    }

}