Cinchoo – ChoObject.ToString(), Part 9

Ignoring members

An object members decorated with ChoMemberFormatterIgnore will be ignored by Cinchoo framework while generating string represent. Here I’ll walk you over with a sample

[ChoTypeFormatter("'{this.Symbol}' Security State")]
public class Security : ChoObject
    public string Symbol;
    public string CompanyName;
    public double Price;

    public Security(string symbol, string companyName, double price)
        Symbol = symbol;
        CompanyName = companyName;
        Price = price;

static void Main(string[] args)
        Security security = new Security("AAPL", "Apple Inc", 457.25);

The output will be

-- 'AAPL' Security State --
        Symbol: AAPL
        CompanyName: Apple Inc

Press any key to continue . . .

Happy coding!!!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s