数据成员无法找到 [英] DataMember could not be found
问题描述
正如我已经做了关于我的这个问题,我的研究,我仍然有解决我的错误1的错误没有运气的类型或命名空间名称'数据成员'找不到(是否缺少using指令或程序集引用?)
As I have done my research regarding this problem of mine, I still have no luck in solving my error of Error 1 The type or namespace name 'DataMember' could not be found (are you missing a using directive or an assembly reference?)
我所遇到的一个解决方案,指出我应该引用 System.Runtime.Serialization 但我仍然。我有没有运气,即使将其添加引用
I have come across a solution stating that I should reference System.Runtime.Serialization but still I am having no luck even when add reference to it.
下面是我的代码:
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
using System.Xml.Serialization;
namespace WebServApp
{
[Serializable]
public class Employee
{
[DataMember]
public int EmpNo { get; set; }
[DataMember]
public string EmpName { get; set; }
[DataMember]
public int DeptNo { get; set; }
[DataMember]
public int Salary { get; set; }
}
}
这是我真正想要的教程遵循:
http://www.dotnetcurry.com/ShowArticle.aspx? ID = 472
谁能帮我这个错误?
推荐答案
我已经解决了这个问题。
我只是删除了System.Runtime.Serialization在项目浏览器中的引用,并通过浏览然后它的工作addded它。奇怪的。
I have solved the problem. I just removed the System.Runtime.Serialization in the references in the project explorer and addded it by browsing then it worked. Weird.
这篇关于数据成员无法找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!