Remove a specified element from the produced array of class objects

  Kiến thức lập trình

I want to remove a certain element from the created array of class objects. The code is provided below here.

DbParameter[] Parameters =
{
    new DbParameter { Parameter = "ExamYear", Value = ExamYear },
    new DbParameter { Parameter = "Gender", Value = Gender },
    new DbParameter { Parameter = "Regid", Value = Regid },
    new DbParameter { Parameter = "Examtype", Value = Examtype }
};

How to remove an element like that. Parameters.Remove(3);?

After eliminating the fourth element, how do I achieve the result as shown in the code below?

DbParameter[] Parameters =
{
    new DbParameter { Parameter = "ExamYear", Value = ExamYear },
    new DbParameter { Parameter = "Gender", Value = Gender },
    new DbParameter { Parameter = "Regid", Value = Regid }
};

New contributor

SAEED AHMED is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT