Wrox Programmer Forums
|
BOOK: Professional .NET 2.0 Generics
This is the forum to discuss the Wrox book Professional .NET 2.0 Generics by Tod Golding; ISBN: 9780764559884
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional .NET 2.0 Generics 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
 
Old March 3rd, 2007, 02:31 PM
Registered User
 
Join Date: Feb 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Typographical error on page 51

This appears to be a typo, in both the downloadable sample code, and on page 51. The code in the ctor should test for inequality.

public class MySampleClass<T> {
    private static List<T> _values;

    static MySampleClass() {
        if (typeof(T).IsAbstract == false)
            throw new Exception("T must not be abstract");
        else
            _values = new List<T>();
    }
}


Ketil Wright
 
Old July 14th, 2008, 12:06 AM
Registered User
 
Join Date: Jul 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I came here to look at the errata when I saw that too. I was hoping it wasn't just me.

 
Old May 22nd, 2013, 05:12 AM
Registered User
 
Join Date: May 2013
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I typed "if (typeof(T).IsAbstract == true)" in my C# instead of "if (typeof(T).IsAbstract == false)" and it worked fine.
A similar issue is already mentioned in the Errata for the VB code.

I tried using the Errata Form to report the problem in C# but the form was asking me for some password so I gave up





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error on source code 7-51? fedrok BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 1 October 15th, 2008 10:51 AM
select ONLY records 51-100 in a MySQL table crmpicco Classic ASP Databases 2 February 24th, 2005 07:21 AM
Phile Page error, visual studio error reps BOOK: ASP.NET Website Programming Problem-Design-Solution 0 September 27th, 2003 10:11 AM





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