English 中文(简体)
类型系统不支持序列运算符. string
原标题:sequence operators not supported for type system.string

此查询中的问题是什么?

              var ptypes = (from mf in _pagecontext.PagesRefs
                let a = mf.nvcr_Slug.Substring(mf.nvcr_Slug.LastIndexOf("/") + 1)  // gets everything after /
                let b = Regex.Replace(a, @"[d-]+$", m => m.Value.Replace( - ,  = ))   // replace last char with =
                let cc = (b.Contains( = ) ? b.Substring(0, b.IndexOf("=")) : b) // strip off everything before = to get original string
                let cm = stroriginal  // string to search
                where cm.Equals(cc)
                select mf); 

nvcr_ slug 可能是

mazhar-kaunain-baig-3-4
mazhar-kaunain-baig-3-4/mazhar-kaunain-baig-3-4
mazhar-kaunain-baig-3-4/mazhar-kaunain-baig-3-4/mazhar-kaunain-baig
abc
abc/abc
abc/abc/abc
问题回答

更新:

基于你的评论 我认为这应该有效:

letb=Regex. replace(a, @"$",=)

在使用 LINQ 的收藏的每次迭代中,您只处理一个值 - 以上应显示给定字符串中最后一个字符, 替换为 < code\\\/ code>


我首先想到的是 LINQ 和 System 之间的冲突。 方法 < code > 的强制实施包含 < / code > 的以下内容:

b. contains (=)

尝试使用系统. string. contains 明确。

使用使用

let cc = (b.Contains("=") ? b.Substring(0, b.IndexOf("=")) : b)

试试看





相关问题
IEnumerable to array of parameter

Using linq? and XML is there a way to convert this IEnumerable to a string array of the value parameter? List<string> idList = new List<string>(); foreach (XElement idElement in word....

linq query for tag system - search for multiple tags

I have two tables, Tags(tagid, postid, tagname) and posts(postid, name, ...) now i want to make a query that returns me all posts that have a generic amount of tags. like: i want all posts that have ...

Linq operations against a List of Hashtables?

I m working with a set of legacy DAO code that returns an IList, where each Hashtable represents the row of a dynamically executed SQL query. For example, the List might contain the following records/...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

How to filter duplicate list items

i have list of items IList with data that looks list this: GenId TestMode 1 0 1 1 3 0 3 1 4 NULL 2 NULL i want to remove the index ...

C# Grouping/Sorting a Generic List<> using LINQ

Im looking to group and sort a Generic List<>. I have a list of objects representing files and each of these objects has a FileName, FileType and FileDate property. FileType is defined as an ...

热门标签