Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #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)?





 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:56 AM.


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