D
Dan Holmes
I am trying to simplify my object creation code so i created a class
factory.
public class IAFClassFactory
{
public Object Create<T>()
{
Type t = typeof(T);
return (T)Activator.GetObject(t, "tcp://kit-dev:9988/" +
t.ToString());
}
}
This is the caller
ISystemMessage sm = (ISystemMessage)cf.Create<ISystemMessage>();
I would like to remove the explicit cast but i don't know how to create
the class factory create method so that i can return something other
than object.
I would like this
ISystemMessage sm = cf.Create<ISystemMessage>();
but if i leave it like that i get and error about needing an explicit cast.
dan
factory.
public class IAFClassFactory
{
public Object Create<T>()
{
Type t = typeof(T);
return (T)Activator.GetObject(t, "tcp://kit-dev:9988/" +
t.ToString());
}
}
This is the caller
ISystemMessage sm = (ISystemMessage)cf.Create<ISystemMessage>();
I would like to remove the explicit cast but i don't know how to create
the class factory create method so that i can return something other
than object.
I would like this
ISystemMessage sm = cf.Create<ISystemMessage>();
but if i leave it like that i get and error about needing an explicit cast.
dan