本文整理汇总了C#中System.Configuration.AppSettingsReader.load方法的典型用法代码示例。如果您正苦于以下问题:C# System.Configuration.AppSettingsReader.load方法的具体用法?C# System.Configuration.AppSettingsReader.load怎么用?C# System.Configuration.AppSettingsReader.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Configuration.AppSettingsReader
的用法示例。
在下文中一共展示了System.Configuration.AppSettingsReader.load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test
public Test(System.String templateFile, System.String encoding)
{
System.IO.StreamWriter writer = null;
TestProvider provider = new TestProvider();
ArrayList al = provider.Customers;
System.Collections.Hashtable h = new System.Collections.Hashtable();
/*
* put this in to test introspection $h.Bar or $h.get("Bar") etc
*/
SupportClass.PutElement(h, "Bar", "this is from a hashtable!");
SupportClass.PutElement(h, "Foo", "this is from a hashtable too!");
/*
* adding simple vector with strings for testing late introspection stuff
*/
System.Collections.ArrayList v = new System.Collections.ArrayList();
System.String str = "mystr";
v.Add(new System.String("hello".ToCharArray()));
v.Add(new System.String("hello2".ToCharArray()));
v.Add(str);
try {
/*
* this is another way to do properties when initializing Runtime.
* make a Properties
*/
//UPGRADE_TODO: Format of property file may need to be changed. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1089"'
System.Configuration.AppSettingsReader p = new System.Configuration.AppSettingsReader();
/*
* now, if you want to, load it from a file (or whatever)
*/
try {
System.IO.FileStream fis = new System.IO.FileStream(new System.IO.FileInfo("velocity.properties").FullName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
if (fis != null) {
//UPGRADE_ISSUE: Method 'java.util.Properties.load' was not converted. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1000_javautilPropertiesload_javaioInputStream"'
p.load(fis);
}
} catch (System.Exception ex) {
/* no worries. no file... */
}
/*
* iterate out the properties
*/
System.Collections.Specialized.NameValueCollection temp_namedvaluecollection;
temp_namedvaluecollection = System.Configuration.ConfigurationSettings.AppSettings;
//UPGRADE_TODO: method 'java.util.Enumeration.hasMoreElements' was converted to ' ' which has a different behavior. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1073_javautilEnumerationhasMoreElements"'
for (System.Collections.IEnumerator e = temp_namedvaluecollection.GetEnumerator(); e.MoveNext(); ) {
//UPGRADE_TODO: method 'java.util.Enumeration.nextElement' was converted to ' ' which has a different behavior. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1073_javautilEnumerationnextElement"'
System.String el = (System.String) e.Current;
//UPGRADE_WARNING: method 'java.util.Properties.getProperty' was converted to ' ' which may throw an exception. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1101"'
Velocity.setProperty(el, (System.String) p.GetValue(el, System.Type.GetType("System.String")));
}
/*
* add some individual properties if you wish
*/
Velocity.setProperty(Velocity.RUNTIME_LOG_ERROR_STACKTRACE, "true");
Velocity.setProperty(Velocity.RUNTIME_LOG_WARN_STACKTRACE, "true");
Velocity.setProperty(Velocity.RUNTIME_LOG_INFO_STACKTRACE, "true");
/*
* use an alternative logger. Set it up here and pass it in.
*/
// SimpleLogSystem sls = new SimpleLogSystem("velocity_simple.log");
// Velocity.setProperty(Velocity.RUNTIME_LOG_LOGSYSTEM, sls );
/*
* and now call init
*/
Velocity.init();
/*
* now, do what we want to do. First, get the Template
*/
if (templateFile == null) {
templateFile = "examples/example.vm";
}
Template template = null;
try
{
template = RuntimeSingleton.getTemplate(templateFile, encoding)
//.........这里部分代码省略.........