如何在linq查询中使用逗号分隔字符串列表 [英] how to separate list of string using comma in linq query
本文介绍了如何在linq查询中使用逗号分隔字符串列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
这里我想用逗号分割字符串列表,我需要linq查询
模型: -
hi to all,
Here i want to split the list of string with comma and i need linq query for that
Model:-
public List<string> name{ get; set; }
如何为上面的表达式写Linq;
对于下面的jscript我想写linq来分割字符串和比较字符串
在这里我这样开始: -
How to write Linq for above expression;
For below jscript i want to write linq to split string and compare string
here i start like that:-
public JsonResult name(string names)
{
**what i write here**
}
And my script is:
$.getJSON('../User/name/' + $('#username').val(), function (data) {
var items = '<option>Select a name</option>';
$.each(data, function (i, qlist) {
items += "<option value='" + qlist.Value + "'>" + qlist.Text + "</option>";
});
$('#2nd dropdown').html(items);
推荐答案
.getJSON('../ User / name /'+
.getJSON('../User/name/' +
('#username')。val(),function(data){
var items ='< 选项 > 选择名称< / option > ';
('#username').val(), function (data) { var items = '<option>Select a name</option>';
.each(data,function(i,qlist){
items + =< 选项 value < span class =code-keyword> =' + qlist.Value +' > + qlist.Text +< / option > ;
});
.each(data, function (i, qlist) { items += "<option value='" + qlist.Value + "'>" + qlist.Text + "</option>"; });
这篇关于如何在linq查询中使用逗号分隔字符串列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文