http://stackoverflow.com/questions/9647641/resharper-warns-static-field-in-generic-type

It's fine to have a static field in a generic type, so long as you know that you'll really get one field per combination of type arguments. My guess is that R# is just warning you in case you weren't aware of that.

Here's an example of that:

using System;

public class Generic<T>
{
// Of course we wouldn't normally have public fields, but...
public static int Foo;
} public class Test
{
public static void Main()
{
Generic<string>.Foo = ;
Generic<object>.Foo = ;
Console.WriteLine(Generic<string>.Foo); //
}
}

As you can see, Generic<string>.Foo is a different field from Generic<object>.Foo - they hold separate values.

最新文章

  1. ImportError: cannot import name &#39;check_arrays&#39;
  2. 所有HTTP请求参数及报文查看SERVLET
  3. 进阶——scrapy登录豆瓣解决cookie传递问题并爬取用户参加过的同城活动&#169;seven_clear
  4. Java ClassLoader基础及加载不同依赖 Jar 中的公共类
  5. 实例化Model的三种方式
  6. android style 中一些颜色的定义
  7. 定义member【C++】cstddef中4个定义
  8. ethtool 在 Linux 中的实现框架和应用
  9. Linux中 pid_t 类型的定义.
  10. js格式转换
  11. python 九九乘法表!小练习
  12. ajax 动态添加商品列表
  13. ReactNative 基础学习
  14. 防盗链与token运用
  15. Git 密钥对处理
  16. Office 365平台及其价值主张
  17. CSS层叠样式表(Cascading Style sheets)
  18. (后端)Mybatis实现批量删除操作(转)
  19. bzoj4773: 负环
  20. 关于 HTTP

热门文章

  1. BZOJ 1711 吃饭dining/Luogu P1402 酒店之王 拆点+最大流流匹配
  2. BZOJ 4695 最假女选手 线段树
  3. 看完这篇 你就能完全操作git 远程分支的增、删、改、查了
  4. drupal8 用户指南
  5. hihoCoder#1082 然而沼跃鱼早就看穿了一切
  6. UVALive 6430 (水dp)
  7. P1547 Out of Hay 洛谷
  8. SPOJ SUMPRO(数学)
  9. Nginx教程收集
  10. JSP的EL表达式语言