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?
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 #region
s to group your properties. You can then collapse the region if you don't want to see it.
#region ViewState Properties
... your properties
#endregion
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With