I am trying to create a class whose constructor includes a variable of type C# class. Are there any packages/keywords/etc. that can allow me to do that? For my specific instance, simply declaring the variable of type will not work.
I think what you are asking is how to create a constructor for a class that allows you to initialize a variable of some other type.
// the class with the parameterized constructor..
public class HasConstructor
{
private ParameterType variable;
public HasConstructor(ParameterType parameter)
{
variable = parameter;
}
}
// the class you want to pass into the above...
public class ParameterType
{
}
// to create an instance of the first class...
new HasConstructor(new ParameterType());
Since I’m not really sure exactly what you are asking, though, I can’t really be sure this is the answer to your question.