Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

Workshop

Quiz

1.What is the correct way to test for value equality with generics?
2.What is a type parameter constraint?
3.What is a closed and open type?

Answers

1.The correct way to test for value equality using generics is to apply the where T : IComparable<T> and use the CompareTo method to perform value equality.
2.A type parameter constraint is when a generic parameter is used as the constraint for another generic parameter.
3.An open type is a generic type that has not been supplied any type arguments for its type parameters. A closed type is a generic type that is not open (that is, it has been supplied a type argument for all its type parameters).


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial