Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reduce code lines saving in viewstate properties

I have a custom server control that has a lot of properties - each of them save their state in viewstate:

    public Color XXX
    {
        get
        {
            return (Color)ViewState["XXX"];
        }
        set
        {
            ViewState["XXX"] = value;
        }
    }

This takes a lot of space - is there a way to reduce the number of lines in the code?

like image 497
ivan Avatar asked Dec 19 '12 20:12

ivan


1 Answers

Remove some of the white space?

public Color XXX
{
    get { return (Color)ViewState["XXX"]; }
    set { ViewState["XXX"] = value; }
}

Honestly I wouldn't concern yourself with the amount of vertical space your code is taking up, if that is truly what your question is about. Use #regions to group your properties. You can then collapse the region if you don't want to see it.

#region ViewState Properties

... your properties

#endregion
like image 155
Cᴏʀʏ Avatar answered Nov 10 '22 04:11

Cᴏʀʏ