Hi Frndz,
Functionality: Subtract List int Value and Display result in List
To achieve this task,
Subtract one value from other value and convert to list as following way
var resultList = displayValue.Select(a => a.FirstValue - a.SecondValue).ToList();
Check below logic
Logic :
Subtract second value from First and Dispaly in LIst
var resultList = displayValue.Select(a => a.FirstValue - a.SecondValue).ToList();
Property with Two Int Value
public ClsProperty(int FirstValue, int SecondValue)
{
_FirstValue = FirstValue;
_SecondValue = SecondValue;
}
private int _FirstValue;
public int FirstValue
{
get { return _FirstValue; }
set { _FirstValue = value; }
}
private int _SecondValue;
public int SecondValue
{
get { return _SecondValue; }
set { _SecondValue = value; }
}
Assign value to Property
List<ClsProperty> displayValue = new List<ClsProperty>();
displayValue.Add(new ClsProperty(45, 120));
displayValue.Add(new ClsProperty(12, 100));
displayValue.Add(new ClsProperty(34, 132));
displayValue.Add(new ClsProperty(56, 45));
Hope this helpful!
Thanks