|
I have a string and I want to compare to another string, and if they are not equal I want my app to do something. How is the not equal statement in C#? Like for equal we have: if(string.Equals(anotherString)) do something. How should I declare if is not equal? Thx
|
|
|
|
|
|
|
I recommend if you really want to learn C#, you buy a book. You really need to have a reference for basic questions like this and not to have to rely on web forums.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Christian Graus wrote: I recommend if you really want to learn C#, you buy a book. You really need to have a reference for basic questions like this and not to have to rely on web forums.
Why?? All the VB developers here (my office), have a terrible fear of Google and any form of documentation.
|
|
|
|
|
huh ?
|
|
|
|
|
leppie wrote: All the VB developers here (my office), have a terrible fear of Google and any form of documentation
I thought you'd have managed to hunt them all down and brand them by now.
|
|
|
|
|
Yes, but this is the C# forum.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Strictly speaking, string comparisons should be done using the special internationalized comparison operations such as string.Compare();[^].
|
|
|
|
|
Pete O'Hanlon wrote: Strictly speaking, string comparisons should be done using the special internationalized comparison operations such as string.Compare();[^].
Very strictly speaking you want to use CompareInfo.Compare for locale independent strings, eg case-insensitive compare of "strasse" and "Straße".
|
|
|
|
|
...guys, I didn't knew that such a simple question would gain such an attention
|
|
|
|
|
leppie wrote: Very strictly speaking you want to use CompareInfo.Compare for locale independent strings, eg case-insensitive compare of "strasse" and "Straße".
Well, I did link to String.Compare(String, String, CultureInfo, CompareOptions) .
|
|
|
|
|
Pete O'Hanlon wrote: Well, I did link to String.Compare(String, String, CultureInfo, CompareOptions).
That is not in my .NET! Which one are you using?
|
|
|
|
|
This member was introduced in .NET Framework 2.0 SP2, 3.0 SP2 and 3.5 SP1.
|
|
|
|
|
Pete O'Hanlon wrote: This member was introduced in .NET Framework 2.0 SP2, 3.0 SP2 and 3.5 SP1.
I do not have 3.5 SP1 (I assume this installs the other SP's too). And your original link does not work... Both IE and FF reports an error.
|
|
|
|
|
Refresh the page after the error. I just had this issue, and it refreshes it OK.
|
|
|
|
|
Urggg. Seems MSDN is down for me, tried some other links now, same result...
|
|
|
|
|
Finally got it loaded, interesting. Thankfully they have a big warning to show that you should not normally have to use this for equality comparison.
|
|
|
|
|
Hi all
I am trying to save my settings into app.config but it doesn't work. I can read data but I can't save it. I see no error.
Can you give me a hint. Here is my code.
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings.Remove("ClientPort");
config.AppSettings.Settings.Add("test", "23232");
config.Save(ConfigurationSaveMode.Full, true);
ConfigurationManager.RefreshSection("appSettings");
Thanks.
|
|
|
|
|
daavena wrote: ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
User based .config files live in another location, somewhere in Documents and Settings/Username/blah/blah.
You probably want to use: PerUserRoamingAndLocal
|
|
|
|
|
I used directx capture dll ,now i want to compress any format ,how to diffreent from one to another audio codecs ,
for example some audio codecs listed in listbox .i want which one is selected the file is created that format ie) if selected mp3 compresser file name is like www.mp3 if selected wma compresser file name is like www.wma
regards
anish...
|
|
|
|
|
I'm sorry, I can't work out what you're asking. You want to have a listbox of codecs and work out what filenames to give them ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
how can i convert .wav file to .raw
|
|
|
|
|
There is nothing built in. You need to buy a tool, or a library, or write a converter.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hello Frnds,
I want to add two numbers through Generic. Im giving my code here plz let me knw my mistake and also suggest the way to come out of this problem
static void Main(string[] args)
{
Addtion<int> e=new Addtion<int>();
e.get(10,20);
Addtion<double> e1=new Addtion<double>();
e1.get(2.5,5.2);
Console.ReadLine();
}
class Addtion<T>
{
public void get(T a,T b)
{
T c = a +b;
Console.WriteLine(c);
//Console.WriteLine(b);
}
}
It's throwing an error
Operator '+' cant be applied to operands of type 'T' and 'T'
|
|
|
|