Hashtable problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Hashtable problem

  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, 11:47 PM
  2. Replies: 0
    Last Post: 12-13-2001, 01:06 PM
  3. a problem with font and language
    By Roseta in forum VB Classic
    Replies: 0
    Last Post: 11-14-2001, 04:24 AM
  4. Replies: 0
    Last Post: 06-23-2000, 03:17 PM
  5. Problem with CryptoAPI and JCE
    By Jason Bock in forum VB Classic
    Replies: 0
    Last Post: 03-21-2000, 07:48 PM

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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center