C# SerializableAttribute由于其保护级别而不可访问

C# SerializableAttribute由于其保护级别而不可访问,c#,serialization,xamarin,xsd,xml-serialization,C#,Serialization,Xamarin,Xsd,Xml Serialization,我在命令提示符下使用xsd.exe创建了一个可序列化的类,该类的结果如下所示,但VS给我的编译错误是,SerializableAttribute由于其保护级别而不可访问 对于DesignerCategoryAttribute也一样。我不知道如何解决这个问题。有人能给我点灯光吗 我正在使用VS2015。Xamarin跨平台、便携式应用程序 所有属性都是公共的,下面显示的rss是根属性 using System.Xml.Serialization; namespace RssResponse {

我在命令提示符下使用xsd.exe创建了一个可序列化的类,该类的结果如下所示,但VS给我的编译错误是,
SerializableAttribute由于其保护级别而不可访问
对于
DesignerCategoryAttribute
也一样。我不知道如何解决这个问题。有人能给我点灯光吗

我正在使用VS2015。Xamarin跨平台、便携式应用程序

所有属性都是公共的,下面显示的rss是根属性

using System.Xml.Serialization;

namespace RssResponse {        

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
    [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
    public partial class rss {

        private rssChannel channelField;

        private decimal versionField;

        private string baseField;
使用System.Xml.Serialization;
命名空间RssResponse{
/// 
[System.CodeDom.Compiler.GeneratedCodeAttribute(“xsd”,“4.6.1055.0”)]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“代码”)]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace=”“,IsNullable=false)]
公共部分类rss{
私人瑞斯夏奈尔渠道油田;
私有十进制版本字段;
专用字符串基址;

您使用的是什么平台?啊,我不认为它是特定于平台的。我现在更新了我的问题。类被放在Xamarin.Forms项目下。我知道它有一些限制,但我不确定这一点IIRC,Xamarin没有可用的
SerializableAttribute
属性;我认为使用了
DataContract
。也有可能您甚至不需要使用
SerializableAttribute
,但我不是肯定的。请尝试删除它并试一试。编辑:嗯,也许它现在就在那里?很抱歉,我不能提供更多帮助。Xamarin Ac的便携版本似乎不支持
SerializableAttribute
实际上,这里所有的答案都是正确的。正如@ChrisSinclair所说,我甚至不需要属性声明。它只需要使用xmlserializer进行序列化即可。