Results 1 to 3 of 3

Thread: [RESOLVED] [2.0] nullable modifier?? when do we need them??

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2003
    Posts
    436

    Resolved [RESOLVED] [2.0] nullable modifier?? when do we need them??

    nullable modifier ...when actually can be helpful? Posted on: 08/12/2006 18:35:35




    I came across in a book I was reading, since we can't assign a null/nothing value to a value type variable,
    we can use nullable modifier to assign a null value.

    My question is, in the real world, how can this C# 2.0 feature be helpful???

    any one has used this ??

    thanks
    regards
    nath

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] nullable modifier?? when do we need them??

    Let's say that you have a field for the date that someone was married. If the person has never been married then that field should be null, but a DateTime variable cannot be null because it is a value type. A Nullable<DateTime> steps in and allows you to use a single variable for either null or an actual date.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2003
    Posts
    436

    Re: [2.0] nullable modifier?? when do we need them??

    thanks Jm

    I found explanation at http://www.codeproject.com/csharp/c_...able_types.asp


    regards
    nath

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width