Csharp/CSharp Tutorial/Development/config file

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Load config file

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;
using System.Xml;
public class MainClass
{
    public static void Main()
    {
        XmlDocument xml = new XmlDocument();
        xml.Load(Environment.GetCommandLineArgs()[0] + ".config");
        XmlTextWriter writer = new XmlTextWriter(Console.Out);
        writer.Formatting = Formatting.Indented;
        xml.WriteTo(writer);
    }
}