本文介绍了我如何在linq中使用Trim的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Linq表达式,我正在为linq使用orderby.您能告诉我如何调整列的值吗?
我的Linq表达式是:
Hi,
i am having a Linq expression, i am using orderby for the linq. can you plz tell how can i trim the value of the column.
My Linq expression is:
var distinctvalues = (from row in Employees
select new
{
row.Address
}).Distinct().ToList();
我在员工中拥有的价值观是
1)"1290 rd"
2)"874 sc"
我想修剪值.您能告诉我如何调整值吗?
the values i have in the employee is
1) " 1290 rd"
2) "874 sc"
i want to trim the value. can you plz tell me how can i trim the value.
推荐答案
row.Address
与
with
row.Address.Trim()
(假设row.Address为字符串).
(this is assuming row.Address is a string).
var distinctvalues = (from row in Employees
select new
{
row.Address.Trim()
}).Distinct().ToList();
我假设row.Address是一个字符串.
I am assuming that row.Address is a string.
这篇关于我如何在linq中使用Trim的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!