c# - Getting all types under a userdefined assembly -


i trying types defined under particular userdefined namespace

assembly.getentryassembly().gettypes().where(t => t.namespace == "namespace")       <>c__displayclass3_0         <>c__displayclass4_0         <>c__displayclass6_0         <>c__displayclass2_0         <>c__displayclass2_1         <>c__displayclass2_2         <>c__displayclass2_3         <>c__displayclass2_4         <>c__displayclass2_5         <>c__displayclass2_6         <>c__displayclass2_7         <>c__displayclass2_8 

my question why getting these type not defined under namespace?

how select type user defined types?

some 1 explain me these , how defined under userdefined namespace.

those types generated compiler. c# compiler generates types implement things like:

  • lambda expressions , anonymous methods
  • iterator blocks
  • async methods
  • anonymous types

all of them should have compilergeneratedattribute applied them, can filter them out way if want:

var types = assembly.getentryassembly()     .gettypes()     .where(t => t.namespace == "namespace")     .where(t => !t.gettypeinfo().isdefined(typeof(compilergeneratedattribute), true)); 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -