I am trying to fetch a column value and convert it as a list of formatted string value and I tried the below code
List<string> _names = (from p in context.RakHolders select string.Format("{0},{1}", p.Name.Split(',')[0].Trim(), p.Name.Split(',')[1].Trim())) .ToList(); My intention is to get a list of names with no unwanted space between commas in the column Name
I am getting exception while executing this line as
An exception of type 'System.NotSupportedException' occurred in EntityFramework.SqlServer.dll but was not handled in user code
Additional information: LINQ to Entities does not recognize the method
'System.String Format(System.String, System.Object, System.Object)' method, and this method cannot be translated into a store expression.
How can I make this work [get a list of formatted column values] with LINQ
AsEnumerable()afterRakHoldersmight be helpful. Check this stackoverflow.com/questions/34061637/….AsEnumerable()aftercontext.RakHolders