Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can't. Anonymouse types only contain properties with public get modifiers and overrides of the GetHashCode(), Equals() and ToString().</p> <pre><code>var myclass = new { Name = "Andy", Location = "Bellingham", Sector = 0, }; </code></pre> <p>From reflector:</p> <pre><code>[CompilerGenerated, DebuggerDisplay(@"\{ Name = {Name}, Location = {Location}, Sector = {Sector} }", Type="&lt;Anonymous Type&gt;")] internal sealed class &lt;&gt;f__AnonymousType0&lt;&lt;Name&gt;j__TPar, &lt;Location&gt;j__TPar, &lt;Sector&gt;j__TPar&gt; { // Fields [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly &lt;Location&gt;j__TPar &lt;Location&gt;i__Field; [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly &lt;Name&gt;j__TPar &lt;Name&gt;i__Field; [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly &lt;Sector&gt;j__TPar &lt;Sector&gt;i__Field; // Methods [DebuggerHidden] public &lt;&gt;f__AnonymousType0(&lt;Name&gt;j__TPar Name, &lt;Location&gt;j__TPar Location, &lt;Sector&gt;j__TPar Sector) { this.&lt;Name&gt;i__Field = Name; this.&lt;Location&gt;i__Field = Location; this.&lt;Sector&gt;i__Field = Sector; } [DebuggerHidden] public override bool Equals(object value) { var type = value as &lt;&gt;f__AnonymousType0&lt;&lt;Name&gt;j__TPar, &lt;Location&gt;j__TPar, &lt;Sector&gt;j__TPar&gt;; return ((((type != null) &amp;&amp; EqualityComparer&lt;&lt;Name&gt;j__TPar&gt;.Default.Equals(this.&lt;Name&gt;i__Field, type.&lt;Name&gt;i__Field)) &amp;&amp; EqualityComparer&lt;&lt;Location&gt;j__TPar&gt;.Default.Equals(this.&lt;Location&gt;i__Field, type.&lt;Location&gt;i__Field)) &amp;&amp; EqualityComparer&lt;&lt;Sector&gt;j__TPar&gt;.Default.Equals(this.&lt;Sector&gt;i__Field, type.&lt;Sector&gt;i__Field)); } [DebuggerHidden] public override int GetHashCode() { int num = 0x5fabc4ba; num = (-1521134295 * num) + EqualityComparer&lt;&lt;Name&gt;j__TPar&gt;.Default.GetHashCode(this.&lt;Name&gt;i__Field); num = (-1521134295 * num) + EqualityComparer&lt;&lt;Location&gt;j__TPar&gt;.Default.GetHashCode(this.&lt;Location&gt;i__Field); return ((-1521134295 * num) + EqualityComparer&lt;&lt;Sector&gt;j__TPar&gt;.Default.GetHashCode(this.&lt;Sector&gt;i__Field)); } [DebuggerHidden] public override string ToString() { StringBuilder builder = new StringBuilder(); builder.Append("{ Name = "); builder.Append(this.&lt;Name&gt;i__Field); builder.Append(", Location = "); builder.Append(this.&lt;Location&gt;i__Field); builder.Append(", Sector = "); builder.Append(this.&lt;Sector&gt;i__Field); builder.Append(" }"); return builder.ToString(); } // Properties public &lt;Location&gt;j__TPar Location { get { return this.&lt;Location&gt;i__Field; } } public &lt;Name&gt;j__TPar Name { get { return this.&lt;Name&gt;i__Field; } } public &lt;Sector&gt;j__TPar Sector { get { return this.&lt;Sector&gt;i__Field; } } } </code></pre>
 

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