怎样一句语Get属性返回 IEnumerable<Assembly>类型

游戏人间 2011-11-05 05:34:35
// Properties
private static IEnumerable<Assembly> AssembliesToSearch
{
get
{
return new <get_AssembliesToSearch>d__4(-2);
}
}

下列是红色行反编译生成的。
// Nested Types
[CompilerGenerated]
private sealed class <get_AssembliesToSearch>d__4 : IEnumerable<Assembly>, IEnumerable, IEnumerator<Assembly>, IEnumerator, IDisposable
{
// Fields
private int <>1__state;
private Assembly <>2__current;
public IEnumerator<AssemblyPart> <>7__wrap8;
private int <>l__initialThreadId;
public AssemblyPart <part>5__5;
public Stream <stream>5__7;
public StreamResourceInfo <streamResourceInfo>5__6;

// Methods
[DebuggerHidden]
public <get_AssembliesToSearch>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
this.<>l__initialThreadId = Thread.CurrentThread.ManagedThreadId;
}

private void <>m__Finally9()
{
this.<>1__state = -1;
if (this.<>7__wrap8 != null)
{
this.<>7__wrap8.Dispose();
}
}

private void <>m__Finallya()
{
this.<>1__state = 2;
if (this.<stream>5__7 != null)
{
this.<stream>5__7.Dispose();
}
}

private bool MoveNext()
{
bool flag;
try
{
switch (this.<>1__state)
{
case 0:
this.<>1__state = -1;
this.<>2__current = typeof(Control).Assembly;
this.<>1__state = 1;
return true;

case 1:
this.<>1__state = -1;
this.<>7__wrap8 = Deployment.Current.Parts.GetEnumerator();
this.<>1__state = 2;
goto Label_00E9;

case 4:
this.<>1__state = 3;
this.<>m__Finallya();
goto Label_00E9;

default:
goto Label_00FF;
}
Label_0075:
this.<part>5__5 = this.<>7__wrap8.Current;
this.<streamResourceInfo>5__6 = Application.GetResourceStream(new Uri(this.<part>5__5.Source, UriKind.Relative));
this.<stream>5__7 = this.<streamResourceInfo>5__6.Stream;
this.<>1__state = 3;
this.<>2__current = this.<part>5__5.Load(this.<stream>5__7);
this.<>1__state = 4;
return true;
Label_00E9:
if (this.<>7__wrap8.MoveNext())
{
goto Label_0075;
}
this.<>m__Finally9();
Label_00FF:
flag = false;
}
fault
{
this.System.IDisposable.Dispose();
}
return flag;
}

[DebuggerHidden]
IEnumerator<Assembly> IEnumerable<Assembly>.GetEnumerator()
{
if ((Thread.CurrentThread.ManagedThreadId == this.<>l__initialThreadId) && (this.<>1__state == -2))
{
this.<>1__state = 0;
return this;
}
return new SetterValueBindingHelper.<get_AssembliesToSearch>d__4(0);
}

[DebuggerHidden]
IEnumerator IEnumerable.GetEnumerator()
{
return this.System.Collections.Generic.IEnumerable<System.Reflection.Assembly>.GetEnumerator();
}

[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}

void IDisposable.Dispose()
{
switch (this.<>1__state)
{
case 2:
case 3:
case 4:
try
{
switch (this.<>1__state)
{
case 3:
case 4:
try
{
}
finally
{
this.<>m__Finallya();
}
break;
}
}
finally
{
this.<>m__Finally9();
}
break;

default:
return;
}
}

// Properties
Assembly IEnumerator<Assembly>.Current
{
[DebuggerHidden]
get
{
return this.<>2__current;
}
}

object IEnumerator.Current
{
[DebuggerHidden]
get
{
return this.<>2__current;
}
}
}
...全文
80 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
游戏人间 2011-11-08
  • 打赏
  • 举报
回复
C#3.5以后的特殊这么难?
游戏人间 2011-11-07
  • 打赏
  • 举报
回复
Action a = null;
<>c__DisplayClassd classd;
a = new Action(classd, (IntPtr) this.<OnCompleteCancel>b__b);
这种反编译过来的是源代码是怎么写的呢?

Action代复杂了。

110,539

社区成员

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

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

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