반사경의 생성자에 표시됩니다.
class Foo { private string _secret = @"all your base are belong to us"; }
메소드 .ctor
Foo
에 따라 리플렉터 표시 생성자
public Foo() { this._secret = "all your base are belong to us"; }
를 갖는로 변환한다.
또한 Foo::.ctor : void
에 ildasm
(마이크로 소프트 비주얼 스튜디오와 함께 제공)이 정보를 볼 수 있습니다 누군가가 당신의 유형과 개인 필드의 이름의 이름을 알고 있다면
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed {
// Code size 19 (0x13)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldstr "all your base are belong to us"
IL_0006: stfld string Playground.Foo::_secret
IL_000b: ldarg.0
IL_000c: call instance void [mscorlib]System.Object::.ctor()
IL_0011: nop
IL_0012: ret
} // end of method Foo::.ctor
마지막으로, 당신이 얻을 수 있습니다 같은 값 :
object o = typeof(Foo).GetField(
"_secret",
BindingFlags.Instance | BindingFlags.NonPublic
).GetValue(f);
Console.WriteLine(o); // writes "all your base are belong to us" to the console
는 물론, 난 항상
var fields = typeof(Foo).GetFields(
BindingFlags.Instance | BindingFlags.NonPublic
);
012과 개인의 모든 필드를 볼 수 있습니다
나는 그것이 거기에 있다고 생각했지만 나는 그것을 발견 할 수 없었다. 정말 고마워! –