Tuesday, December 20, 2022

Remove records from LINQ ASP.NET C#

 var institutes = dt.AsEnumerable().Select(d => new { Institute = d.Field<String>("institute") }).Distinct();

            

            string json = js.Serialize(institutes.Where(a => a.Institute != null));


reference:- https://stackoverflow.com/questions/38381612/c-sharp-linq-remove-null-values-from-an-array-and-return-as-not-nullable

No comments:

Post a Comment