我是新来的..
问题:
你有一个外部设置文件,并使用sharpdevelop从visual basic .net 4.0中读取信息吗?
感谢您的回答。
答案 0 :(得分:1)
通过配置文件我假设你的意思是app.config文件。
SharpDevelop支持使用ConfigurationManager从app.config的appSettings部分获取值的旧样式:
<appSettings>
<add key="PageSize" value="10" />
</appSettings>
Dim PageSize As Integer =
Configuration.ConfigurationManager.AppSettings("PageSize")
它还支持更新的使用设置文件的方式,该文件会在app.config和生成的VB.NET类中添加自定义部分。
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="WindowsApplication1.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<WindowsApplication1.My.MySettings>
<setting name="PageSize" serializeAs="String">
<value>0</value>
</setting>
</WindowsApplication1.My.MySettings>
</userSettings>
My.Settings.Default.PageSize
SharpDevelop和Visual Studio之间的主要区别在于您必须创建My Project文件夹结构,并通过文件属性在.settings文件上将命名空间设置为My。 Visual Studio将在您创建新项目时创建.settings文件,使其更容易上手。