locked
Constraints in C## RRS feed

  • Question

  • what are the constraints in c#?

     

    • Edited by Reed Copsey, JrMVP Saturday, February 12, 2011 12:05 AM Deleting advertisements
    Monday, July 19, 2010 9:54 AM

Answers

  • When you define a generic class, you can apply restrictions to the kinds of types that client code can use for type arguments when it instantiates your class. If client code attempts to instantiate your class with a type that is not allowed by a constraint, the result is a compile-time error. These restrictions are called constraints.

    See For More Details: http://msdn.microsoft.com/en-us/library/d5x73970(VS.80).aspx


    Manish Sati
    • Marked as answer by SamAgain Tuesday, July 20, 2010 6:31 AM
    Monday, July 19, 2010 10:06 AM

All replies

  • When you define a generic class, you can apply restrictions to the kinds of types that client code can use for type arguments when it instantiates your class. If client code attempts to instantiate your class with a type that is not allowed by a constraint, the result is a compile-time error. These restrictions are called constraints.

    See For More Details: http://msdn.microsoft.com/en-us/library/d5x73970(VS.80).aspx


    Manish Sati
    • Marked as answer by SamAgain Tuesday, July 20, 2010 6:31 AM
    Monday, July 19, 2010 10:06 AM
  • Thank you for your valuable  reply..

    Ajay John

     

    • Edited by Reed Copsey, JrMVP Saturday, February 12, 2011 12:06 AM Removing advertisements
    Tuesday, July 20, 2010 9:27 AM