I am parsing an HTTP GET request string in my components. When trying to make it modular (the number and types of parameters can vary greatly), I want to have a base class or an abstract parameter interface that determines whether a property was set or not, as well as a Set method that sets the cost. Is there a way to do this with a variable parameter type for the Set method?
The general idea is this:
public abstract class Parameter
{
public bool IsSet { get; protected set; }
protected Parameter() { IsSet = false; }
public abstract void Set( --unknown type here-- );
}
A sample child parameter would then look like this:
public class IntParameter : Parameter
{
public int Value { get; protected set; }
public void Set(int value)
{
Value = value;
IsSet = true;
}
}
, , . IsSet , , "" , , . , .
, , , , , .
- , . , , Google.
, , :
- . , , , , , .
- , of() - , , .
?:)