title: Why Does Code Generate MSIL Class Called <>c__DisplayClass1
body: <p>I have this code,    </p>
  
  <pre><code>private bool MatchingBreak(IEnumerable&lt;CarriagewaySummary&gt; breaks, int startMetres, int divisionPosition)
      {
          CarriagewaySummary matchingBreak = breaks.Where(x =&gt;
          {
              return x.StartMetres == startMetres &amp;&amp; x.EndMetres == divisionPosition;
          }).SingleOrDefault();
          return matchingBreak != null;
      }
  </code></pre>
  
  <p>Why does that generate a nested class called &lt;>c__DisplayClass1 in the MSIL?</p>
  
  <pre><code>.class nested private auto ansi sealed beforefieldinit &lt;&gt;c__DisplayClass1
  extends object
  {
  .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
      01 00 00 00
  )
  // Fields
  .field public int32 startMetres
  .field public int32 divisionPosition
  
  // Methods
  .method public hidebysig specialname rtspecialname 
      instance void .ctor () cil managed 
  {
      // Method begins at RVA 0x56fb
      // Code size 7 (0x7)
      .maxstack 8
  
      IL_0000: ldarg.0
      IL_0001: call instance void object::.ctor()
      IL_0006: ret
  } // End of method &lt;&gt;c__DisplayClass1..ctor
  
  .method public hidebysig 
      instance bool &lt;MatchingBreak&gt;b__0 (
          class TreatmentLengthDynamicSegmentation.Domain.CarriagewaySummary x
      ) cil managed 
  {
      // Method begins at RVA 0x5704
      // Code size 37 (0x25)
      .maxstack 2
      .locals init (
          [0] bool 
      )
  
      IL_0000: nop
      IL_0001: ldarg.1
      IL_0002: callvirt instance int32 TreatmentLengthDynamicSegmentation.Domain.CarriagewaySummary::get_StartMetres()
      IL_0007: ldarg.0
      IL_0008: ldfld int32 class TreatmentLengthDynamicSegmentation.ScriptHelpers.DivisionManager/&lt;&gt;c__DisplayClass1::startMetres
      IL_000d: bne.un.s IL_001f
      IL_000f: ldarg.1
      IL_0010: callvirt instance int32 TreatmentLengthDynamicSegmentation.Domain.CarriagewaySummary::get_EndMetres()
      IL_0015: ldarg.0
      IL_0016: ldfld int32 class TreatmentLengthDynamicSegmentation.ScriptHelpers.DivisionManager/&lt;&gt;c__DisplayClass1::divisionPosition
      IL_001b: ceq
      IL_001d: br.s IL_0020
      IL_001f: ldc.i4.0
      IL_0020: stloc.0
      IL_0021: br.s IL_0023
      IL_0023: ldloc.0
      IL_0024: ret
  } // End of method &lt;&gt;c__DisplayClass1.&lt;MatchingBreak&gt;b__0
  
  } // End of class TreatmentLengthDynamicSegmentation.ScriptHelpers.DivisionManager/&lt;&gt;c__DisplayClass1
  </code></pre>
  
  <p>The generated code is interfering with Nitriq Code Analysis, so I want to understand why it's there.</p>