private void render(Security security) { Func<double, string> toCurrency = (number) => String.Format("{0:n2}", number); Func<string, string> toEnglish = (value) => { // TODO: Make this more robust if (value == "0.00") return "None"; else if (value == "NaN") return "N/A"; else return value; }; Func<double, string> process = (number) => toEnglish(toCurrency(number)); string sell = process(security.Sell); string buy = process(security.Buy); string spread = process(security.Spread); string percentage = process(security.Percentage); string capitalization = process(security.Capitalization); string volume = String.Format("{0:n}", security.Volume); string[] row = { security.Name, sell, buy, volume, spread, percentage, capitalization }; ListViewItem item = new ListViewItem(row); this.securitiesListView.Items.Add(item); }
public SecurityArgs(Security security) { this.security = security; }