Hi is it possible to Create New Classes in C# ,classes which the Application Read's from XML and Declare they're Attributes also reading from XML . like :
<item id=1>
<Name>John</Name>
<Surname>Kennedy</Surname>
<Age>24</Age>
</item>
bests.
In the preceding code ClassName is a variable, that contains the class name to be created. This class helps to create a dynamic assembly at run time. This is a sealed class and has no constructor. The object of this class is created using the DefineDynamicAssembly method of the AppDomain class.
Dynamic Class creation enables you to create a Java class on the fly at runtime, from source code created from a string. Dynamic class creation can be used in extremely low latency applications to improve performance.
You can create custom dynamic objects by using the classes in the System. Dynamic namespace. For example, you can create an ExpandoObject and specify the members of that object at run time. You can also create your own type that inherits the DynamicObject class.
Classes can be dynamically created using the type() function in Python. The type() function is used to return the type of the object. The above syntax returns the type of object.
Yes it is with System.Reflection.Emit namespace.
But in .net 4.0 you can use dynamic keywoard for this. Like this http://blogs.msdn.com/b/mcsuksoldev/archive/2010/02/04/dynamic-xml-reader-with-c-and-net-4-0.aspx
without dynamic, even if you create new class, you will need reflection to access their properties
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With