How to call custom operator with Reflection

C# compiler converts overloaded operator to functions with name op_XXXX where XXXX is the operation. For example, operator + is compiled as op_Addition. Here is the full list of overloadable operators and their respective method names: ┌──────────────────────────┬───────────────────────┬──────────────────────────┐ │ Operator │ Method Name │ Description │ ├──────────────────────────┼───────────────────────┼──────────────────────────┤ │ operator + │ op_UnaryPlus │ Unary │ │ … Read more

Create object instance of a class from its name in string variable

Having the class name in string is not enough to be able to create its instance. As a matter of fact you will need full namespace including class name to create an object. Assuming you have the following: string className = “MyClass”; string namespaceName = “MyNamespace.MyInternalNamespace”; Than you you can create an instance of that … Read more

Difference between LoadFile and LoadFrom with .NET Assemblies?

Does this clear it up? // path1 and path2 point to different copies of the same assembly on disk: Assembly assembly1 = Assembly.LoadFrom(path1); Assembly assembly2 = Assembly.LoadFrom(path2); // These both point to the assembly from path1, so this is true Console.WriteLine(assembly1.CodeBase == assembly2.CodeBase); assembly1 = Assembly.LoadFile(path1); assembly2 = Assembly.LoadFile(path2); // These point to different assemblies … Read more