티스토리 뷰
아래 예제는 Generic Dictionary의 XML Serialization 가능 여부를 시험해 보기 위해서 만든 것이다.
결과는 Exception이 발생했다.
Generic Dictionary 타입은 지원하지 않는다는 메세지가 나왔다.
using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;
namespace SerializationTest
{
class Program
{
static void Main(string[] args)
{
Dictionary<string, int> myDictionary = new Dictionary<string, int>();
myDictionary["One"] = 1;
myDictionary["Two"] = 2;
XmlSerializer myXmlSerializer = new XmlSerializer(typeof(Dictionary<string, int>));
using (XmlWriter writer = XmlWriter.Create("serialization.xml"))
{
myXmlSerializer.Serialize(writer, myDictionary);
}
}
}
}
결과는 Exception이 발생했다.
Generic Dictionary 타입은 지원하지 않는다는 메세지가 나왔다.
using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;
namespace SerializationTest
{
class Program
{
static void Main(string[] args)
{
Dictionary<string, int> myDictionary = new Dictionary<string, int>();
myDictionary["One"] = 1;
myDictionary["Two"] = 2;
XmlSerializer myXmlSerializer = new XmlSerializer(typeof(Dictionary<string, int>));
using (XmlWriter writer = XmlWriter.Create("serialization.xml"))
{
myXmlSerializer.Serialize(writer, myDictionary);
}
}
}
}
'Show' 카테고리의 다른 글
| 인텔 칩셋 비교 (G31, G33, P31, P35) (0) | 2007.12.23 |
|---|---|
| XmlSerializer의 버그? TimeSpan 클래스를 못 다루는 문제 (0) | 2007.12.16 |
| Visual C# 2005 단축키 (shortcuts) (0) | 2007.12.11 |
| C# & .NET , BCL에 대한 단상 (0) | 2007.12.09 |
| 단위 : Power Prefixes (0) | 2007.12.09 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- DotNetMagic
- 애드센스숨기기
- iTextSharp
- registry
- tagREADYSTATE
- java
- 애드센스감추기
- AdSense숨기기
- ScreenHunter
- 유틸리티
- download.com
- Service pack
- AdSense감추기
- AxWebBrowser
- Microsoft
- 스크린캡쳐
- Automation
- Sample Code
- c#
- windows
- Rollback Rx
- jre
- iText
- WinAutomation
- Phalanger
- .net framework
- READYSTATE_COMPLETE
- Regular Expressions
- autohotkey
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
글 보관함