CSharp · Console
using System;
using System.Linq;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
var result = deployments.Select(x =>
{
return new
{
Status = x.Status.ToString(),
x.EnterpriseServiceId
};
});
foreach (var r in result)
{
Console.WriteLine(r);
}
}
private static List<Deployment> deployments = new List<Deployment>
{
new Deployment{EnterpriseServiceId = 0, Status = Status.Active, },
new Deployment{EnterpriseServiceId = 1, Status = Status.InActive, }
};
}
public class Deployment
{
public int EnterpriseServiceId
{
get;
set;
}
public Status Status
{
get;
set;
}
}
public enum Status
{
Active = 1,
InActive,
}