Custom style class
I think that the implementation in Chapter 3 of the custom style class is slightly less efficient than it could be. It's a minor point, but if you look at the following methods:
public override bool IsEmpty
{
get
{
return base.IsEmpty && !IsSet("BackImageRepeat");
}
}
public override void Reset()
{
base.Reset();
if (IsEmpty)
return;
if (IsSet("BackImageRepeat"))
ViewState.Remove("BackImageRepeat");
}
public override void CopyFrom(Style s)
{
if (s == null)
return;
base.CopyFrom(s);
CustomTableStyle cts = s as CustomTableStyle;
if (cts != null || cts.IsEmpty)
{
if (cts.IsSet("BackImageRepeat"))
this.BackImageRepeat = cts.BackImageRepeat;
}
}
Aren't the calls to IsEmpty() from Reset() and CopyFrom() unnecessary since you are basically checking IsSet("BackImageRepeat") twice? And if you had more custom styles you would then be checking each of those twice as well (assuming that at least one has been actually set so you get past the IsEmpty() call)?
|