Skip to content

Instantly share code, notes, and snippets.

@kou-yeung
Created December 21, 2017 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kou-yeung/a8b45b7225d3a5307c1439429b534b99 to your computer and use it in GitHub Desktop.
Save kou-yeung/a8b45b7225d3a5307c1439429b534b99 to your computer and use it in GitHub Desktop.
class Program
{
static string path = @"[PATH]\Sample.xml";
static void Main(string[] args)
{
// typeof(Table)の XmlSerializer を生成する。
// 第2引数に GetOverrides() を渡すの注目してください。
var serializer = new XmlSerializer(typeof(Table), GetOverrides());
// ファイルを開いてデシリアライズする。(ここは通常通りです)
using (var stream = new FileStream(path, FileMode.Open))
{
var table = serializer.Deserialize(stream) as Table;
// ... デシリアライズ結果を使用する
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment