我编写了小型 WM 6.1 应用程序,它可以读取和写入 xml,但出现以下异常:
System.PlatformNotSupportedException was unhandled
Message="PlatformNotSupportedException"
StackTrace:
at System.Globalization.CompareInfo..ctor(Int32 culture)
at System.Globalization.CompareInfo.GetCompareInfo(Int32 culture)
at System.Globalization.CultureInfo.get_CompareInfo()
at System.CultureAwareComparer..ctor(CultureInfo culture, Boolean ignoreCase)
at System.StringComparer.Create(CultureInfo culture, Boolean ignoreCase)
at System.Data.DataTable.GetSpecialHashCode(String name)
at System.Data.DataColumnCollection.RegisterColumnName(String name, DataColumn column, DataTable table)
at System.Data.DataColumnCollection.BaseAdd(DataColumn column)
at System.Data.DataColumnCollection.AddAt(Int32 index, DataColumn column)
at System.Data.DataColumnCollection.Add(DataColumn column)
at System.Data.DataColumnCollection.Add(String columnName, Type type)
at MyApp.Settings.CreateDT(String Setting, String Key, String Value)
at MyApp.Program.Main()
这里是 CreatDT 方法体:
public static DataTable CreateDT(string Setting, string Key, string Value)
{
DataTable dt;
dt = new DataTable(Setting);
dt.Columns.Add("Key", Type.GetType("System.String")); //<-- error here
dt.Columns.Add("Value", Type.GetType("System.String"));
AddRow(ref dt, Key, Value);
return dt;
}
任何身体帮助?