I've just decompiled some 3rd party source to debug an issue, using DotPeek. The output code contains some unusual operators, which AFAIK aren't valid C#, so I'm wondering what they mean...
The extract looks like (with Dotpeek comments included, as they are probably relevant);
protected internal void DoReceive(ref byte[] Buffer, int MaxSize, out int Written)
{
Written = 0;
.
.
.
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
int& local = @Written;
int num = SomeMethod();
.
.
.
// ISSUE: explicit reference operation
^local = num;
}
So, 3 unusual operators in there... int& = @Written
seems to be assigning a pointer to a variable that is named pointlessly with the @ character?
But what is ^local = num;
???
OK, here is the equivalent snippet from ILSpy, which makes more sense, I guess the decompile to C# didn't produce a valid equivalent?
'C#'
int& local = @Written;
byte[] numArray2 = this.FInSpool;
int num = (int) __Global.Min(numArray2 == null ? 0L : (long) numArray2.Length, (long) MaxSize);
^local = num;
IL
byte[] expr_22 = this.FInSpool;
Written = (int)__Global.Min((long)((expr_22 == null) ? 0 : expr_22.Length), (long)MaxSize);
So, I guess the 'C#' isn't quite valid? That IL would be valid C#, not sure why DotPeek produced the output it did. Perhaps I'll stick to ILSpy for this one...?
^local
relates to the fact thatWritten
is an out parameter. It seems to be dereferencing the pointer. – Capitular