C# Error
CS1026 – ) expected
Reason for the Error & Solution
) expected
An incomplete statement was found.
A common cause of this error is placing a statement, rather than an expression, within an inline expression in an ASP.NET page. For example, the following is incorrect:
<%=new TimeSpan(DateTime.Now.Ticks - new DateTime(2001, 1, 1).Ticks).Days;%>
The following is correct:
<%=new TimeSpan(DateTime.Now.Ticks - new DateTime(2001, 1, 1).Ticks).Days %>
It is interpreted as follows:
<% Response.Write(new TimeSpan(DateTime.Now.Ticks - new DateTime(2001, 1, 1).Ticks).Days); %>
The following example generates CS1026:
// CS1026.cs
#if (a == b // CS1026, add closing )
#endif
class x
{
public static void Main()
{
}
}