C#的正确版本号是多少?什么时候出来?为什么我找不到关于C#3.5的任何答案?
这个问题主要是为了帮助那些使用不正确的版本号搜索答案的人,例如C#3.5.希望任何未能找到错误版本号的答案的人都会找到这个问题,然后再使用正确的版本号进行搜索.
.net c# .net-framework-version visual-studio compiler-version
我想在我的app.config文件中添加自定义配置部分.有没有办法做到这一点,如何在我的程序中访问这些设置.以下是我要添加到我的配置部分app.config:
<RegisterCompanies>
<Companies>
<Company name="Tata Motors" code="Tata"/>
<Company name="Honda Motors" code="Honda"/>
</Companies>
</RegisterCompanies>
Run Code Online (Sandbox Code Playgroud) 下面的示例使用我从代码中获取的BackupDirectories列表填充ItemsControl.
如何更改此设置以便从app.config文件中获取相同的信息?
XAML:
<Window x:Class="TestReadMultipler2343.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="160"/>
</Grid.ColumnDefinitions>
<TextBlock
Grid.Row="0"
Grid.Column="0"
Text="Title:"/>
<TextBlock
Grid.Row="0"
Grid.Column="1"
Text="{Binding Title}"/>
<TextBlock
Grid.Row="1"
Grid.Column="0"
Text="Backup Directories:"/>
<ItemsControl
Grid.Row="1"
Grid.Column="1"
ItemsSource="{Binding BackupDirectories}"/>
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
后台代码:
using System.Collections.Generic;
using System.Windows;
using System.Configuration;
using System.ComponentModel;
namespace TestReadMultipler2343
{
public partial class Window1 : Window, INotifyPropertyChanged
{
#region ViewModelProperty: Title
private string _title;
public string Title
{
get …Run Code Online (Sandbox Code Playgroud) 我试过了
<appSettings >
<add key="List" value="1"/>
<add key="List" value="2"/>
<add key="List" value="3"/>
</appSettings >
Run Code Online (Sandbox Code Playgroud)
和 System.Configuration.ConfigurationManager.AppSettings.GetValues("List");
但我只得到最后一个成员.我怎么能轻易解决这个问题?