Contents tagged with Reflection
today I want to show sample of code that you can use for your plugins.
Sometime it can happen that you have some application with it's dlls and you can decide to make ad hoc dlls.
In order to demonstrate how to do it I prepared following code:
Create first class library as BaseLib:
public class BaseClass : MarshalByRefObject
public virtual bool IsProcessable(string message)
public virtual void Process(string message)
Then create following implementation:
public … more
today I want to give sample of reading available types from dll .net assembly, check if at least one of them implements interface, and if implements then to create instance of that type and return it.
So, imagine you have such interface declaration in your code:
public interface ILogger
/// Convert <see cref="LoggerMessage"/> to string based on the formats specified.
/// <param name="message">The message to be converted.</param>
/// <returns>Converted <paramref name="message"/>.</returns>
LoggerMessage Handle(LoggerMessage message);
bool Handlable(LoggerMessage message); … more