类文件如下:
public partial class coursefm : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private string _cID;
private string _cName;
#region 可扩展性方法定义
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OncIDChanging(string value);
partial void OncIDChanged();
partial void OncNameChanging(string value);
partial void OncNameChanged();
#endregion
public coursefm()
{
OnCreated();
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_cID", DbType="NChar(10) NOT NULL", CanBeNull=false, IsPrimaryKey=true)]
public string cID
{
get
{
return this._cID;
}
set
{
if ((this._cID != value))
{
this.OncIDChanging(value);
this.SendPropertyChanging();
this._cID = value;
this.SendPropertyChanged("cID");
this.OncIDChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_cName", DbType="VarChar(50) NOT NULL", CanBeNull=false)]
public string cName
{
get
{
return this._cName;
}
set
{
if ((this._cName != value))
{
this.OncNameChanging(value);
this.SendPropertyChanging();
this._cName = value;
this.SendPropertyChanged("cName");
this.OncNameChanged();
}
}
}
出错代码如下
private void button2_Click(object sender, RoutedEventArgs e)
{
t1 = courseIDbox.Text;
t2 = courseNamebox.Text;
coursefm csf = new coursefm
{
cID = t1;
cName = t2;
}
}
报错如下
严重性 代码 说明 项目 文件 行
错误 CS1513 应输入 } WpfApplication1 E:\study\FINALWORK\WpfApplication1\WpfApplication1\Window1.xaml.cs 38
错误 CS1022 应输入类型、命名空间定义或文件尾 WpfApplication1 E:\study\FINALWORK\WpfApplication1\WpfApplication1\Window1.xaml.cs 43