Forums - C# Corner

Forum guidelines
Mani Kandan

Mani Kandan

  • 525
  • 2k
  • 111.9k

list object if contain one value then return another one c#

Dec 23 2016 5:29 AM
Hello,
 
I have list items
The Priority list's object may contain 1 or 2 or 3.
 
If Priority contain 1 then return "Low"
If Priority contain 2 then return "Medium"
If Priority contain 3 then return "High"
 
I have tried... 
  1. public class DocumentsUser  
  2.     {  
  3.   public string Priority { getset; }  
  4. }  
  5.   
  6. List<DocumentsUser> objUserSetUp = objUserSetUp1.Select(m => new DocumentsUser()  
  7.                 {   
  8.  Priority = m.Priority == 3 ? "High" : "Low"//Here I want to manage that contition.  
  9. }  
 How can I do that?

Answers (5)