What value to use to indicate infinite RRS feed

  • Question

  • We are having a discussion here about what integer value to use to indicate infinites. For example we need to be able to restrict the maximum number of sessions.


    Should we use 0, -1 or null to indicate that the user does not have a maximum number of sessions? What if the user is not allowed to have any sessions at all? And what about uknown number of sessions?


    What do you think?

    Thursday, December 27, 2007 2:45 PM


  • Gabriel,


    That's a bit of an open-ended question!


    If you are defining values to have particular meaning, does a value of 0 or -1 already have some meaning to the intended system?  If not, then I don't think that it really matters.  If you define the values through an enumeration, then it really doesn't matter at all, as you can change it at any point anyway.


    You could also use int.MinValue and int.MaxValue too, just to add some other values that might be used as values for enumerations.


    I hope this helps,


    Martin Platt.

    Wednesday, January 2, 2008 1:20 AM