Operator '==' cannot be applied to operands of type 'string[]' and 'string'

I have the following C# code and the line - " if(a == "Document Library") break; " - is giving me the error -
Operator '==' cannot be applied to operands of type 'string[]' and 'string'
I am not very familar with c# and would appreciate any help as to how to get around this. I have checked google but can't see anything covering this.
Cheers for all help...

string [] a;
currentFolder = currentFolder.Replace("%2f","/");
currentFolder = currentFolder.Replace("%20"," ");
a = currentFolder.Split('/');
for(int i=(a.Length-1);i>=0;i--)
if(a == "Document Library") break;
if(tmp.Length > 0)
tmp = " / " + tmp;
tmp = a + tmp;
10/1/2004 9:47:54 AM
asp.net.web-forms 93655 articles. 6 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 16

    if(a == "Document Library") break;
    if(a[i] == "Document Library") break;
And, later in the code, change
    tmp = a + tmp;
    tmp = a[i] + tmp;

10/1/2004 10:06:16 AM

cheers worked great..
10/1/2004 11:12:37 AM

Similar Artilces:

Cast from type ''''DBNull'''' to type ''''String'''' is not valid.
How do I avoid getting this error: Cast from type ''''DBNull'''' to type ''''String'''' is not valid. I am trying to get values from the database into a form for updating using a Datareader, SQL is set to allow nulls for certain fields as they are not required but the only way I can get the form to display is by adding a space in SQL. Is there another way around this? Check if it is equal to DBNull.Value first and if it is, don't do the cast.Stanley Tan theSpoke Blog Where in the code does it need to go? I am using the following and it's the profile that isn't always requi...

Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/ GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

Operator '&&' cannot be applied to operands of type 'bool' ... 'string'"
Hi friends .I get the following error for this line of code "if (QSDealID = (dr.GetString(1) && ((tt.TotalSeconds)<= 15) && (ip) = dr.GetString(4)))"  error:Operator '&&' cannot be applied to operands of type 'bool' ... 'string'" I need ur urgent help...Gurjeet,England Hi There, Im not 100% know what variable you have here, but i guess this is what you trying to do: if ( (QSDealID == dr.GetString(1)) && ( tt.TotalSeconds <= 15) && (ip == dr.GetString(4)) ) Equal operand in C# is == NOT = Hope...

Operator '&' is not defined for types 'String' and 'System.Web.UI.WebControls.TextBox'
Can anyone tell me what this error message means, and what to do to correct it.  Here is the code that has the error:  Dim sql As Stringsql = "INSERT INTO tblConnecting (Date, Member, Name, Company, Phone, Fax, Address, NamesofAttendees, PaymentType, Email) " _ & "Values('" & Today() & "', '" & blnMember & "', '" & Me.txtName.Text & "', '" & Me.txtCompany.Text & "', '" _& Me.txtPhone.Text & "', '" & Me.txtFax.Text &...

Cannot convert from 'string[]' to 'string'
 string[] nId = Request[PageConstants.QueryStringNotificationInstanceId].Split('/');if(string.IsNullOrEmpty(nId) == false){code } I am getting an error: Cannot convert from 'string[]' to 'string'    How to type cast this to string type. Would appreciate and help please!! Thanks!   You really can't. Since "nId" is a string array, all you can really do is extract a single element as a string like so: string x = nId[0];Thanks, EdMicrosoft MVP - ASP/ASP.NET Thanks ecburk!I did try that earlier! string[] nId = Request[P...

BC30452: Operator '&' is not defined for types 'String' and 'System.Web.UI.WebControls.AccessDataSource'.
hi everyone, i keep getting the error page... Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30452: Operator '&' is not defined for types 'String' and 'System.Web.UI.WebControls.AccessDataSource'. Source Error:   Line 20: Line 2...

'do' won't 'do' if '/'
Greetings to All from Au, Have a NetWare Perl 5.8.4 and wanted to tweak File\Spec\NW.pm to try and standardise on '/' separators. If I run a test script (t/uni/lower.t) with an unmodified NW.pm, it calls t/uni/case.pl, that, in case.pl, (when the path separators are '\'), the $file is '..\lib\unicore\To\Lower.pl' and the following code portion works, with $simple getting a returned table: sub casetest { my ($base, $spec, $func) = @_; my $file = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, "lib", &qu...

CS0019: Operator '-' cannot be applied to operands of type 'System.DateTime' and 'int'
here is my error codearrCalendar[(dtmDate.Month - 1), (dtmDate.Date - 1)] = myNotes.Text;   datetime.month is an int not sure what this is not working?Ben DateTime.Date returns a DateTime value. Instead you will need to do this: DateTime m_CurrentDate = DateTime.Date;arrCalendar[(dtmDate.Month - 1), (m_CurrentDate.AddDays(-1)] = myNotes.Text; HTH,RyanRyan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.comHow to ask a question ahhh my bad I ment to do day not date. thank you, didn't mean to waste your time!Ben...

Error 60 Operator '&' is not defined for types 'System.Web.UI.WebControls.TextBox' and 'String'.
The comment control is a textbox:<td align="right" style="width: 228px"><asp:TextBox ID="comment" runat="server" TextMode="multiLine" Rows="10" Columns="50" onkeyup="return ismaxlength(this)" Width="260px" Height="100px" Font-Overline="false" /></td> and I'm being told by VS (underlined in blue ) that the for the comment field: Error 60 Operator '&' is not defined for types 'System.Web.UI.WebControls.TextBox' and 'String...

Cannot implicitly convert type 'string[]' to 'string'
Hello Everyone, i have file name "sample.txt". it contains customer order information like order id, cust id, and the order information. the below code is in c# . it has ReadButton which reads the info from the file. now my problem is how get the string[] CustResult value to be shown in Label box.protected void ReadButton_Click(object sender, EventArgs e) {  StreamReader Sr = new StreamReader(Server.MapPath(".") + "/confirm/sample.txt"); String ReadContents = Sr.ReadToEnd();char Delimiter = '\n'; char TabDelimiter = '...

Name: L Lachowsky Email: e2brutus_10atyahoodotcom Product: Firefox Summary: ''' Comments: why duddn this surprise me... I change default server from IE to Mozilla, and then i get error messages. well, shud I decide to not get on my computer with Mozilla..or shud I risk security breeches with IE....hmmm at least i can get on the internet with IE Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv: Gecko/2008120122 Firefox/3.0.5 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this fee...

Operator '==' incompatible with operand types 'Int64' and 'Object'
I have the typical gridview control driving a formview control.  Both use LinqDataSources.  I'm using the table's ID field, DelID to find the record to be displayed by the FormView when a record is selected from the GridView.  This gives me the above error.  Why, and how do I fix this?Diane Check the type of the operands you are trying to compare.You will have to cast on your operands. something like intvariable == (int)objectvariable; or if(((object)intvariable).Equals(objectvariable))*** If this post helps you, then Mark this post as Answer *** I'm ...

BC30452: Operator '&' is not defined for types 'String' and 'System.IO.Stream'.
I try to upload an file into an image-field in my SQL but I get this error: BC30452: Operator '&' is not defined for types 'String' and 'System.IO.Stream'. What is this error and how can I solve it? Piece of the code:Dim MyFileCollection As HttpFileCollectionDim MyFile As HttpPostedFileDim FileLen, Loop1 As IntegerDim bijlage As Stringbijlage = ""Dim MyStream As System.IO.StreamDim ContentType As StringMyFileCollection = Request.FilesMyFile = MyFileCollection(0)ContentType = MyFile.ContentTypeFileLen = MyFile.ContentLengthDim Input(FileLen) As ByteMyStream = MyFile.InputStreamA...