Comparison operators not supported for type 'System.String[]'

后端 未结 5 2117
渐次进展
渐次进展 2020-12-11 22:20

why this line:

var category = _dataContext.Categories.Where(p => p.Keywords.Split(\' \').Contains(context.Request.QueryStrin         


        
5条回答
  •  执笔经年
    2020-12-11 23:14

    It's probably the case that context.Request.QueryString["q"] returns a string array instead of a single string. This is because a url may contain multiple parameters with the same name.

    If you are sure there is always just one parameter named q on the request, you can change your code to this: context.Request.QueryString["q"].SingleOrDefault().

提交回复
热议问题