[XmlIgnore]
[NonSerialized]
public List<string> paramFiles { get; set; } //I get the following error: //Attribute 'NonSerialized' is not valid on this declaration type.
It is only valid on 'field' declarations.
 
 
Well... the first error says that you can't do that... from http://msdn.microsoft.com/en-us/library/system.nonserializedattribute.aspx
 [AttributeUsageAttribute(AttributeTargets.Field, Inherited = false)]
[ComVisibleAttribute(true)]
public sealed class NonSerializedAttribute : Attribute

I suggest using backing field

 public List<string> paramFiles { get { return list;}  set { list = value; } }
[NonSerialized]
private List<string> list;

参考:https://stackoverflow.com/questions/7693391/nonserialized-on-property

延伸:https://www.cnblogs.com/shy1766IT/p/5459707.html    Json序列化指定输出字段 忽略属性

NonSerialized 属性忽略序列化报错'NonSerialized' is not valid on this declaration type的更多相关文章

  1. notification 报错the method build() is undefined for the type Notificatin.Builder

    notification 报错the method build() is undefined for the type Notificatin.Builder 这事api版本号太低导致的 Notifi ...

  2. Eclipse怎么忽略掉报错的js文件

    第一步,我们要先定位错误在哪里,选择菜单里window——show view——other,选择Problems. 第二步,点击有红叉的项目,在Problems视图中,可以看到是什么错,哪个文件夹中的 ...

  3. 对象逆序列化报错:java.lang.ClassNotFoundException

    简单的想从保存的对象中又一次解析出对象.用了逆序列化,但是报错: java.lang.ClassNotFoundException: xxxxxxxxxxxx at java.net.URLClass ...

  4. MyEclipse忽略js报错

    MyEclipse对官网下载的js报错,解决办法如下: 1. 对js文件右键选择 MyEclipse --> Exclude From Validation 2. 然后继续右键执行MyEclip ...

  5. ref 属性使用eslint报错

    react 使用 ref 报错 ,[eslint] Using string literals in ref attributes is deprecated. (react/no-string-re ...

  6. angular中datetime-local属性使用ng-model报错

    项目需求是将年月日格式更改为年月日时分的格式展示,翻遍了整个项目没找到符合的组件,自己现敲一个也来不及,只好直接使用原生自带的组件--datetime-local.之前都是用的vue写项目,第一次接触 ...

  7. 在angular项目中使用bootstrap的tooltip插件时,报错Property 'tooltip' does no t exist on type 'JQuery<HTMLElement>的解决方法和过程

    在angular4的项目中需要使用bootstrap的tooltip插件. 1. 使用命令安装jQuery和bootstrap npm install bootstrap jquery --save ...

  8. 淘宝druid报错:javax.management.InstanceNotFoundException: com.alibaba.druid:type=DruidDataSourceStat

    问题: 启动tomcat报错: Tomat报出一下异常:ERROR [com.alibaba.druid.stat.DruidDataSourceStatManager] – unregister m ...

  9. junit的Test不能使用,报错信息:Test is not an annotation type

    在使用junit的Test做测试时,注解@Test报错”Test is not an annotation type”,发现是因为测试类的类名命名为了Test,所以导致错误. 测试类类名不能直接命名为 ...

随机推荐

  1. html布局-子div浮动后,父容器撑不开解决

    文章:子div撑不开父div的几种解决办法: 1,可以在所有子元素后增加<div style="clear:both;"></div> 2,给父容器增加样式 ...

  2. Linux系统下文件压缩与打包命令

    Linux系统下文件压缩与打包命令 常用的压缩文件拓展名 * .Z * .zip * .gz * .bz2 * .xz * .tar * .tar.gz * .tar.bz2 * .tar.xz 压缩 ...

  3. Git收藏

     Git Flow 的正确使用姿势 https://www.jianshu.com/p/41910dc6ef29 git合并分支上的commit为一条commit到master  https://ww ...

  4. linux系统编程之信号(二)

    经过了漫长的间歇,对于c语言的学习也被中断了很久,现实确实有很多的无耐,计划中的事情总会被打乱,但不管怎样,学习的道路是不能休止的,所以经过了一断温习后现在继续学习C语言,话不多说,进入正题: 信号分 ...

  5. python的简介(解释器、变量、用户交互、if语句)

    一.python的起源 python是吉多·范罗苏姆(Guido van Rossum)在1989年的圣诞节期间因为无聊打发时间所开发的一个脚本解释程序. python是一门解释型.弱类型的编程语言. ...

  6. maven的使用和环境搭建

    请在博客分类的未分类中找到这篇文章

  7. RestTemplate将字符串以文件的方式上传

    背景 在java后台将内容拼接为字符串,然后使用RestTemplate将字符串以文件的方式上传到指定接口 思路 使用 RestTemplate 时,将字符串封装为字节流,然后上传 代码 /** * ...

  8. IDEA 中tomcat图片储存和访问虚拟路径(图片和程序分家)

    本文链接:https://blog.csdn.net/qq_36481052/article/details/78813213 **前段时间,遇到了图片已经储存了文件中也显示有图片,但就是死活访问不到 ...

  9. YAML_02 playbook的ping脚本检测

    ansible]# vim ping.yml --- - hosts: all   remote_user: root   tasks:      - ping: ansible]# ansible- ...

  10. Win10 Subsystem Linux : Ubuntu 的root密码

    安装完Ubuntu后忽然意识到没有设置root密码, 不知道密码自然就无法进入根用户下.Ubuntu的默认root密码是随机的, 即每次开机都有一个新的root密码.我们可以在终端输入命令 sudo ...