function overloading, why is it done?
Code:
public SqlCommand GetCommand(string commandText, CommandType commandType, params SqlParameter[] parameters) { SqlCommand cmd = new SqlCommand();
cmd.Connection = GetConnection();
cmd.CommandText = commandText;
cmd.CommandType = commandType;
foreach(SqlParameter p in parameters) {
cmd.Parameters.Add(p);
}
return cmd;
}
public SqlCommand GetCommand(string commandText, params SqlParameter[] parameters) {
return GetCommand(commandText, CommandType.StoredProcedure, parameters);
}