如何使用c#比较两个值 [英] How to compare two values using c#
本文介绍了如何使用c#比较两个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我有一个小问题,如何比较两个值
这里一个值比较值列表,
例如,如果字符串s =csharp,则此值比较值列表
解决方案
请参阅:在.NET Framework中使用字符串的最佳实践 [ ^ ]
欲了解更多详情,请点击以下链接:
如何:比较字符串(C#编程指南) [ ^ ]
字符串。比较Method(String,String,Boolean) [ ^ ]
String.Contains Method(String) [ ^ ]
您可以使用String.Compare()比较两个字符串
例如:
string MyString = csharp的跨度>;
Console.WriteLine( String .Compare(MyString, csharpexample跨度>));
Hi All,
I have a small issue,how to compare two values
here one single value compare in list of values,
for example if string s="csharp",this value compare list of values
解决方案
Please, see this: Best Practices for Using Strings in the .NET Framework[^]
For further details, please follow these links:
How to: Compare Strings (C# Programming Guide)[^]
String.Compare Method (String, String, Boolean)[^]
String.Contains Method (String)[^]
Hi,
You can use String.Compare() for compare two strings
For ex:
string MyString = "csharp"; Console.WriteLine(String.Compare(MyString, "csharpexample"));
这篇关于如何使用c#比较两个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文