Which is generally best to use -- StringComparison.OrdinalIgnoreCase or StringComparison.InvariantCultureIgnoreCase?
By : user240869
Date : March 29 2020, 07:55 AM
|
Can we shorten s1.Equals(s2, StringComparison.InvariantCultureIgnoreCase)?
By : JKeegan
Date : March 29 2020, 07:55 AM
will help you You can write an extension method for it. code :
namespace ExtensionMethods
{
public static class MyExtensions
{
public static bool MyEqual(this String s1, string s2)
{
return s1.Equals(s2, StringComparison.InvariantCultureIgnoreCase);
}
}
}
|
Does the culture of the StringComparison type of String.Equals matter?
By : Jessica Lazaro
Date : March 29 2020, 07:55 AM
|
Why does string.Equals work for case insensitivity by default?
By : Jason Thomas
Date : March 29 2020, 07:55 AM
will help you Actually, all LINQ expressions against CRM context is converted by LINQ provider to QueryExpression. And string.Equals filter is defined there as case insensitive, so you get this result. About your attempt with StringComparison.OrdinalIgnoreCase, IMO it could be (and I think it is) that the provider does not support that method with a second parameter (I've tried and it does not return desired result with other comparison types either).
|
How to fix Error CA1307 with string.Contains(string, System.StringComparison)?
By : Ondřej Vágner
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further StringComparison is an enum - the warning suggests that you're meant to specify one of the values within that enum, e.g. StringComparison.Ordinal. However, this warning is wrong on two counts:
|