PDA

View Full Version : MonoDevelop Question Regarding the String class



rngomez
March 28th, 2007, 05:03 PM
Hello and thank you for your time in advance. I am using MonoDevelop and C#.
Issue: When trying to compile the following code, I get an error.


string sLine = "this is a line:";
bool bCheck = sLine.Contains("line");

The compiler tells me that System.String does not contain a definition for 'Contains'. I know that this code will compile under Windows using Visual Studio. I also know that the class does indeed contain that function and that I am using correctly. This leads me to conclude that I have not set something up correctly, or that there is some type of bug involved. That function appears in the editor, so MonoDevelop must be aware of it on some level.

I am a part time developer, so I'm not new to C#, but I am pretty new to using MonoDevelop and using a *nix platform. The System namespace is imported (using) and referenced.
Any ideas?

_teo_
March 29th, 2007, 09:24 PM
perhaps it is not implemented in mono
you may try as an workaround:


int IndexOf (string value)

mardawi
March 30th, 2007, 03:16 AM
Mono is currently compatible with .net 1.1
String.Contains is only available in .net 2.0 and 3.0

http://msdn2.microsoft.com/en-us/library/system.string.contains.aspx

use _teo_ suggestion instead.

lukew
March 31st, 2007, 04:13 PM
Mono is currently compatible with .net 1.1
String.Contains is only available in .net 2.0 and 3.0

http://msdn2.microsoft.com/en-us/library/system.string.contains.aspx

use _teo_ suggestion instead.

You can switch to version 2 though even on the mono website they say that this is currently flakey!! :o anyone tried?