Question:Suppose you want to eliminate duplicate elements from the array int[] source = { 7, 4, 1, 3, 9, 8, 6, 7, 2, 1, 8, 15, 8, 23} and sort the elements in descending order using LINQ in .Net framework 4.0. Which of the following statements can you use? 

A var result = (from s in source orderby s select distinct s).Descending(); 

B var result = (from s in source orderby s descending select s).Distinct(); 

C var result = select distinct s from s in source sortby s descending; 

D var result = from s in source orderby s descending group p by s select s; 

+ Answer
+ Report
Total Preview: 865

Copyright © 2024. Powered by Intellect Software Ltd