Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2
This is the forum to discuss the Wrox book Professional ASP.NET 2.0 Server Control and Component Development by Dr. Shahram Khosravi; ISBN: 9780471793502
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 9th, 2007, 03:39 AM
Registered User
 
Join Date: Jan 2007
Location: Beaumont, CA, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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)?







Similar Threads
Thread Thread Starter Forum Replies Last Post
Switching back to class instead of style nerssi Javascript 4 September 26th, 2008 03:12 AM
Smalltalk-style class browser for VS? Raconteur Visual Studio 2005 3 May 3rd, 2007 11:10 AM
Recordset Style Class owain Pro VB 6 4 August 22nd, 2003 01:01 PM
Setting the Style Sheet class jacob ASP.NET 1.0 and 1.1 Basics 4 August 20th, 2003 01:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.