[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. 那些可作为GC Roots的对象

    原文:https://blog.csdn.net/u010798968/article/details/72835255 一.名词解释 根搜索算法是JVM用来的判断对象是否存活的算法,此算法基本思路为 ...

  2. 下载nvidia-docker2的rpm包

    现在慢慢进入GPU的世界, 参考安装URL: https://github.com/NVIDIA/nvidia-docker # If you have nvidia-docker 1.0 insta ...

  3. 微信小程序API~检查登录状态

    wx.checkSession(Object object) 检查登录态是否过期. 通过 wx.login 接口获得的用户登录态拥有一定的时效性.用户越久未使用小程序,用户登录态越有可能失效.反之如果 ...

  4. Spring -10 -<bean>的 scope 属性 -singleton 默认值/prototype 多例 /request /session /application /global session

    1.<bean>的属性; 2.作用:控制对象有效范围(单例,多例等)3.<bean/>标签对应的对象默认是单例的. 3.1无论获取多少次,都是同一个对象 Teacher t1 ...

  5. DT二次开发之-资讯列表中调用 TAG 关键词

    资讯列表加文章关键词:(列表或搜索主字段加上 ,tag) {if $t[tag]} <p class="key"> 关键词: {php $tag = str_repla ...

  6. HTTP和HTTPS的区别和常见的面试题

    本篇会着重介绍http和https的区别和常见的面试题 常见的http和https面试题: Http与Https的基本概念和他们的区别 HTTPS工作原理 常用的HTTP方法有哪些 GET方法与POS ...

  7. CH6303 天天爱跑步

    6303 天天爱跑步 0x60「图论」例题 描述 小C同学认为跑步非常有趣,于是决定制作一款叫作<天天爱跑步>的游戏.<天天爱跑步>是一个养成类游戏,需要玩家每天按时上线,完成 ...

  8. jsp里导入java包的问题

    写jsp导包的时候出了两处错误(什么?特么两处,总共就一句话啊...): 新建jsp文件会自动生成一句: <%@ page language="java" import=&q ...

  9. 网络 IP

    参考原文 http://blog.csdn.net/dan15188387481/article/details/49873923 1. 原始的IP地址表示方法及其分类(近几年慢慢淘汰)     IP ...

  10. linux学习2 Linux云计算学习环境介绍

    一.VNC: Virtual Network Computing协议.虚拟网络计算协议. vncviewer:client vncserver:server