Note that there are some explanatory texts on larger screens.

plurals
  1. POUnusual C# operators in decompiled source...?
    primarykey
    data
    text
    <p>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...</p> <p>The extract looks like (with Dotpeek comments included, as they are probably relevant);</p> <pre><code>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&amp; local = @Written; int num = SomeMethod(); . . . // ISSUE: explicit reference operation ^local = num; } </code></pre> <p>So, 3 unusual operators in there... <code>int&amp; = @Written</code> seems to be assigning a pointer to a variable that is named pointlessly with the @ character?</p> <p>But what is <code>^local = num;</code> ???</p> <p>OK, here is the equivalent snippet from ILSpy, which makes more sense, I guess the decompile to C# didn't produce a valid equivalent?</p> <p><strong>'C#'</strong></p> <pre><code> int&amp; local = @Written; byte[] numArray2 = this.FInSpool; int num = (int) __Global.Min(numArray2 == null ? 0L : (long) numArray2.Length, (long) MaxSize); ^local = num; </code></pre> <p><strong>IL</strong></p> <pre><code> byte[] expr_22 = this.FInSpool; Written = (int)__Global.Min((long)((expr_22 == null) ? 0 : expr_22.Length), (long)MaxSize); </code></pre> <p>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...?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload