Skip to content

Instantly share code, notes, and snippets.

@morales-franco
Created April 16, 2019 21:27
Show Gist options
  • Select an option

  • Save morales-franco/46581836ad6492e11deffb1252d73648 to your computer and use it in GitHub Desktop.

Select an option

Save morales-franco/46581836ad6492e11deffb1252d73648 to your computer and use it in GitHub Desktop.
Reflection
public ICommunicator GetCommunicator(string typeName)
{
Type communicatorType = Type.GetType(typeName);
if (communicatorType == null)
throw new NullReferenceException();
ICommunicator communicator = Activator.CreateInstance(communicatorType, new object[] { new ConnectionParameters()
{
IP = "My IP",
Port = 993
} }) as ICommunicator;
return communicator;
}
var communicator = communicatorService.GetCommunicator("Integra.Communicator.Zk.CommunicatorApi,Integra.Communicator.Zk");
foreach (var user in communicator.GetUsers())
Console.WriteLine($"Identifier: { user.Identifier }");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment