I am begging in c# .
What is mean “where” in all this class?
Why i am used “where” in code?
what is benefit about Where Keyword ?
public abstract class AbstractEntity
{
}
public abstract class AbstractControl<E> where E: AbstractEntity
{
public abstract void Add(E entity);
public abstract void Modify(E entity);
public abstract void Remove(E entity);
}
public abstract class AbstractSQLServerControl<E> : AbstractControl<E> where E : AbstractEntity
{
protected SQLServerConnectionManager connectionManager;
public AbstractSQLServerControl(string connectionString)
{
connectionManager = new SQLServerConnectionManager(connectionString);
}
}
whereis known as a constraint. It makes sure that your Type ParameterEis derived fromAbstractEntity. If an interface was specified after thewhere,Ewould need to implement that interface.