DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    27

    Hashtable problem

    i am using c#. I have a hashtable called _SpecialDays of DayInfo objects and am having troble accessing them.

    Code:
    return _SpecialDays[Day].EndOfDay - _NormalStartOfDay;
    C:\Documents and Settings\.....DaysInfo.cs(97): 'object' does not contain a definition for 'EndOfDay'

    btw Day is the key, the DayInfo object has a defination for EndOfDay and '- _NormalStartOfDay' has nothing to do with it.

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    You must cast _SpecialDays[Day] from object back to DayInfo before you may access its EndOfDay property:

    Code:
    DayInfo di = _SpecialDays[Day] as DayInfo;
    if (di != null)
    {
        return di.EndOfDay - _NormalStartOfDay;
    }
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Mar 2004
    Posts
    27
    Thanks
    Merry Christmas

Similar Threads

  1. Problem with Search
    By Irina in forum ASP.NET
    Replies: 0
    Last Post: 11-29-2002, 10:47 PM
  2. Replies: 0
    Last Post: 12-13-2001, 12:06 PM
  3. a problem with font and language
    By Roseta in forum VB Classic
    Replies: 0
    Last Post: 11-14-2001, 03:24 AM
  4. Replies: 0
    Last Post: 06-23-2000, 02:17 PM
  5. Problem with CryptoAPI and JCE
    By Jason Bock in forum VB Classic
    Replies: 0
    Last Post: 03-21-2000, 06:48 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links