c#命名不对, private IList k__BackingField

徐家大哥 2009-07-26 04:17:49
用reflector返编译的文件中,居然有这样的命名方式,但编译不通过。 知道的朋友请告知一下。

[CompilerGenerated]
private IList<int> <ValueList>k__BackingField;

[CompilerGenerated]
private int <BitmapWidth>k__BackingField;

[CompilerGenerated]
private double <YScale>k__BackingField;

...全文
1263 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
徐家大哥 2009-08-05
  • 打赏
  • 举报
回复
难道需要手工更改这种代码?有没有办法让反编译的代码显示正常?
wuyq11 2009-07-26
  • 打赏
  • 举报
回复
CompilerGenerated是反编译生成的代码如
public class MyClass
{
public string Name{set;get;}
public string Value { set; get; }

public MyClass(string pName, string pValue)
{
Name = pName;
Value = pValue;
}

}
反编译后
反编译后
public class MyClass
{
// Fields
[CompilerGenerated]
private string <Name>k__BackingField;
[CompilerGenerated]
private string <Value>k__BackingField;

// Methods
public MyClass(string pName, string pValue)
{
base..ctor();
this.Name = pName;
this.Value = pValue;
return;
}

// Properties
public string Name
{
[CompilerGenerated]
get
{
string str;
str = this.<Name>k__BackingField;
Label_0009:
return str;
}
[CompilerGenerated]
set
{
this.<Name>k__BackingField = value;
return;
}
}

public string Value
{
[CompilerGenerated]
get
{
string str;
str = this.<Value>k__BackingField;
Label_0009:
return str;
}
[CompilerGenerated]
set
{
this.<Value>k__BackingField = value;
return;
}
}
}
jasondct 2009-07-26
  • 打赏
  • 举报
回复
命名空间要用这个的吧
System.Collections.Generic
微创社(MCC) 2009-07-26
  • 打赏
  • 举报
回复
[CompilerGenerated]是需要命名空间的,当然通不过,也不可能起作用。
其它的不过是泛型
vwxyzh 2009-07-26
  • 打赏
  • 举报
回复
[CompilerGenerated] - 编译器生成的,命名当然不是按照c#的命名规范来的

110,541

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧