官术网_书友最值得收藏!

  • Roslyn Cookbook
  • Manish Vasani
  • 123字
  • 2021-07-15 17:07:33

Creating a method body analyzer to analyze whole method and report issues

A stateful method body or code block analyzer registers action callbacks that require whole method body analysis to report issues about the method declaration or executable code. These analyzers generally need to initialize some mutable state at the start of the analysis, which is updated while analyzing the method body, and the final state is used to report diagnostics.

In this section, we will create a code block analyzer that flags unused method parameters. For example, it will not flag param1 and param2 as unused, but will flag param3 and param4.

void M(int param1, ref int param2, int param3, params int[] param4)
{
int local1 = param1;
param2 = 0;
}
主站蜘蛛池模板: 阿克陶县| 合川市| 安泽县| 福海县| 兴安县| 汝阳县| 五台县| 凤凰县| 香港| 弥勒县| 白山市| 乐陵市| 堆龙德庆县| 莲花县| 岚皋县| 抚顺县| 洪江市| 永昌县| 香河县| 偏关县| 微博| 建昌县| 新乡市| 禹州市| 嘉祥县| 易门县| 铜陵市| 高青县| 通化市| 酒泉市| 土默特左旗| 安仁县| 聂荣县| 安塞县| 武鸣县| 井冈山市| 汕尾市| 南京市| 克什克腾旗| 张家口市| 临漳县|