I want to import a xml file that allows creation of objects dynamically. I realize that I need to use reflection. Below is an img of the error that tries create an instance of a class via the Type.GetType method. But it is returning an error and never goes to next line. I included the class it is trying to instigate.
Below is the class in question
public class AuthenticationWorker : Worker
{
public AuthenticationWorker():base()
{
}
protected override Task<object> DoWork()
{
throw new NotImplementedException();
}
protected override void Initalize(params string[] parameters)
{
foreach (var param in parameters)
System.Diagnostics.Debug.WriteLine(param);
}
}
And this is the abstract class Worker
public abstract class Worker
{
public enum LogLevel
{
Debug = 0,
Warning = 1,
Error = 2
}
public Worker()
{
}
protected List<KeyValuePair<LogLevel, string>> Logs;
protected Dictionary<string, string> Parameters;
protected Dictionary<string, object> MetaData;
public void AddLog(LogLevel logLevel, string description)
{
if (Logs == null)
Logs = new List<KeyValuePair<LogLevel, string>>();
Logs.Add(new KeyValuePair<LogLevel, string>(logLevel, description));
}
abstract protected Task<object> DoWork();
abstract protected void Initalize(params string[] parameters);
}
Aucun commentaire:
Enregistrer un commentaire