Is it possible to create a class at runtime from a file without parsing it?
If this is not the best way to get class properties, constructors and methods from a file? Whereas a file can have more than one class, like a regular cs file.
Yes, it is possible to create a class at runtime from a file.
Dynamic source code generation and compilation
You can use the Runtime (Reflection) compiler in MS.NET
Look here
ASP.NET, BuildManager.GetCompiledAssembly.
:
Assembly a = BuildManager.GetCompiledAssembly("~/TestClass.cs"); foreach (Type t in a.GetExportedTypes()) { object obj = Activator.CreateInstance(t) // Do something with obj... }
Source: https://habr.com/ru/post/1723395/More articles:Where are NHibernate / Hibernate HQL and ICriteria sample queries? - ormWhy does Win32 HeapReAlloc () change values? - cDeclaring functors for comparison? - c ++Javascript / scope variable closing issue - I know this works, but why? - javascriptКак создать пользовательский UIAlertView - objective-cMYSQL DATE function runs insanely slower in LEFT JOIN - phphttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1723397/moving-files-between-independent-repositories-in-svn&usg=ALkJrhg-g5cnmj1BcFGHl2iHlVnEbXpDAgРазметка интерфейса JAX-RS и вставка @Context - jax-rsInput Applications Soundflower - c ++Текстуры XNA.Fbx - xnaAll Articles