摘要: File = App.config<?xmlversion="1.0"encoding="utf-8"?><configuration><configSections><sectionname="systems"type="ConfigConsoleApplication.SystemsSection,ConfigConsoleApplication"/></configSections><systems><systemname=&quo 阅读全文
posted @ 2008-03-03 15:53 靓点博客 阅读(207) 评论(0) 推荐(0) 编辑
摘要: VS2003中对于应用程序配置文件(app.config或者web.config)只提供了读取的功能。而在VS2005中,对于配置文件的功能有了很大的加强。在VS2005中,对于应用程序配置文件的读写一般使用Configuration,ConfigurationManager两个类。ConfigurationManager类为客户应用程序提供了一个访问的功能。使用ConfigurationManager对象执行打开配置文件的操作后,将会返回一个Configuration的对象。通过程序实现读写配置文件的代码如下所示:1 创建配置文件中的配置节所对应的类。该类必须继承自Configuration 阅读全文
posted @ 2008-03-03 15:41 靓点博客 阅读(234) 评论(0) 推荐(0) 编辑
摘要: Asp.NET 操作配置文件 Asp.NET 操作配置文件 1. Web 项目 1.1 系统自带 1)打开配置文件(Web.config) Configuration config = WebConfigurationManager.OpenWebConfiguration("~"); 2)获取相应的appSettings配置节 AppSettingsSection appSection = (AppSettingsSection)config.GetSection("appSettings"); 3)增加相应的appSettings配置节 4)保存配置 阅读全文
posted @ 2008-03-03 14:02 靓点博客 阅读(207) 评论(0) 推荐(0) 编辑
摘要: test.config-configuration<?xmlversion="1.0"encoding="utf-8"?><configuration><configSections><sectionname="add"type="WindowsApplication2.ConfigSectionData,WindowsApplication2,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null"/></con 阅读全文
posted @ 2008-03-03 14:01 靓点博客 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 自定义配置文件的名称,不需要exe.config。具体的实现代码如下ExeConfigurationFileMap^filemap=gcnewExeConfigurationFileMap;filemap->ExeConfigFilename="1.xml"; //OpenApp.ConfigofexecutableSystem::Configuration::Configuration^config= ConfigurationManager::OpenMappedExeConfiguration(filemap,ConfigurationUserLevel::No 阅读全文
posted @ 2008-03-03 13:17 靓点博客 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 反射的概述反射appDomain的程序集反射单个程序集利用反射获取类型信息设置反射类型的成员通过反射创建类型的实例反射类型的接口反射的性能反射的概述反射的定义:审查元数据并收集关于它的类型信息的能力。元数据(编译以后的最基本数据单元)就是一大堆的表,当编译程序集或者模块时,编译器会创建一个类定义表,一个字段定义表,和一个方法定义表等,。System.reflection命名空间包含的几个类,允许你反射(解析)这些元数据表的代码和反射相关的命名空间(我们就是通过这几个命名空间访问反射信息):System.Reflection.MemberInfoSystem.Reflection.EventIn 阅读全文
posted @ 2008-03-03 11:27 靓点博客 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2008-03-03 11:15 靓点博客 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 绪论特性(Attributes)是一种崭新的声明性信息。我们不仅可以通过特性来定义设计层面的信息(例如help file, URL for documentation)以及运行时(run-time)信息(例如使XML与class相联系),而且我们还可以利用特性建立自描述(self-describing)组件。在这篇教程中,我们将会看到如何建立和添加特性到各种程序实体以及如何在运行时环境中获取特性信息。定义正如MSDN中所描述的那样----- “特性是被指定给某一声明的一则附加的声明性信息。”使用预定义(Pre-defined)特性在C#中,有一个小的预定义特性集合。在学习如何建立我们自己的定制 阅读全文
posted @ 2008-03-03 10:45 靓点博客 阅读(179) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Reflection;class Program{static void Main(){System.Attribute[] attrs = Attribute.GetCustomAttributes(typeof(xxx));foreach (System.Attribute attr in attrs){if (attr is aaa){aaa a = (aaa)attr;Console.WriteLine("name={0},version={1}",a.Name,a.Version);}}}}[aaa(" 阅读全文
posted @ 2008-03-03 09:58 靓点博客 阅读(266) 评论(0) 推荐(0) 编辑