Mansoor

Mansoor

  • NA
  • 66
  • 6.4k

A new expression requires () or [] after type in C# code

Sep 28 2012 9:50 AM

Hi ,

I wrote below code, when i run this i got below  issue:  Plz guide me?

A new expression requires () or [] after type
Stack Trace at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInterna........................

Code:


System.Web.UI.WebControls.
ListItem Dept_Lstitem1 = new System.Web.UI.WebControls.ListItem();
string deptcode="3301000";

List
<string> ASGforMembersServices_Deptcodes = new List<string> { "3300000", "3301000", "3302000", "3303000", "3304000", "3305000", "3306000", "3307000", "3308000" };


if (ASGforMembersServices_Deptcodes.Contains(deptcode))
{


ddl_ToDepartment.Items.Add(Dept_Lstitem1);
}

Answers (1)