Click here to Skip to main content
15,900,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

When Iam using the below condition showing error:

Code: if (FileSystem.Dir() == SortDirection.Ascending)
{
}


Error: cannot be applied to operands of type string; and ;System.Web.UI.WebControls.SortDirection; C:\inetpub\wwwroot\Radar5C\POInvoice\frmPaymentEntry.aspx.cs
Posted

1 solution

Dir() returns a string an SortDirection.Ascending is of type SortDirection. As they are of different types you can't ask if they are equal, it's like asking if an apple equals an orange.

The code makes no sense anyway, how can the name of a folder equal a sort order? If you are trying to see if the direction is literally called SortDirection then do

if (FileSystem.Dir() == SortDirection.Ascending.ToString())
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900