How to perform a case-sensitive LINQ query in Azure?

前端 未结 1 599
温柔的废话
温柔的废话 2021-01-24 18:18

I am using Windows Azure Storage Tables, and want to query for an object. The user inputs a string, which I look for in the database as such:

var myKey = \"SomeC         


        
1条回答
  •  面向向阳花
    2021-01-24 18:52

    Using == is the same as .Equals(..), as it just calls that method. You can force to use a case sensitive comparison using an overload of Equal() passing a string.comparison enum

    CurrentCulture                   Compare strings using culture-sensitive sort rules and the current culture.
    CurrentCultureIgnoreCase         Compare strings using culture-sensitive sort rules, the current culture, and ignoring the case of the strings being compared.
    InvariantCulture                 Compare strings using culture-sensitive sort rules and the invariant culture.
    InvariantCultureIgnoreCase       Compare strings using culture-sensitive sort rules, the invariant culture, and ignoring the case of the strings being compared.
    Ordinal                          Compare strings using ordinal sort rules.
    OrdinalIgnoreCase                Compare strings using ordinal sort rules and ignoring the case of the strings being compared.
    

    more info at:

    http://msdn.microsoft.com/en-us/library/system.stringcomparison.aspx

    0 讨论(0)
提交回复
热议问题