Files
mono/mcs/class/System.Configuration/Test/standalone/t35.cs
T
Atsushi Eno 521c0ea909 2006-05-10 Atsushi Enomoto <[email protected]>
* Makefile : add -r:System.Configuration under net_2_0.

	* ConfigurationSettings.cs : use ConfigurationManager.GetConfig()
	  in its GetConfig(). No need to change AppSettings and
	  Default.GetConfig() behavior here.

	* t35.cs, t35.exe.config, t35.exe.expected :
	  new test, largely from bug #78337.

	* ConfigurationManagerTest.cs :
	  added GetSectionReturnsNativeObject().

	* ConfigurationElement.cs,
	  DefaultSection.cs :
	  in some cases RawXml was set null string, so skip such cases.
	* Configuration.cs : support IConfigurationSectionHandler here.
	* ConfigurationManager.cs : GetSection() now returns name value
	  collection, not a section.
	* ConfigurationSection.cs : added SectionHandler for
	  IConfigurationSectionHandler support, and use its Create() in
	  GetRuntimeObject().
	* ClientConfigurationSystem.cs :
	  use GetRuntimeObject() in GetSection(). Thus now
	  ConfigurationManager.GetSection() returns a runtime object.
	  Fixed bug #78337.



svn path=/trunk/mcs/; revision=60483
2006-05-10 03:39:56 +00:00

47 lines
1.1 KiB
C#

using System;
using System.Configuration;
using System.Collections.Generic;
namespace TestLib1
{
public class Class1
{
public void testIT()
{
object o = System.Configuration.ConfigurationManager.GetSection("testlib1");
List<System.Xml.XmlNode> sectionList = (List<System.Xml.XmlNode>) o;
Console.WriteLine("count: " + sectionList.Count);
}
}
}
namespace TestApp1
{
class Program
{
static void Main(string[] args)
{
TestLib1.Class1 testApp1 = new TestLib1.Class1();
testApp1.testIT();
}
}
}
namespace TestLib1
{
public sealed class ConfigSectionHandler : IConfigurationSectionHandler
{
public object Create(object parent, object configContext, System.Xml.XmlNode section)
{
List<System.Xml.XmlNode> sectionList = new List<System.Xml.XmlNode>();
foreach (System.Xml.XmlNode sectionXmlNode in section.SelectSingleNode("mynodes").ChildNodes)
{
sectionList.Add(sectionXmlNode);
}
return sectionList;
}
}
}