Blue Theme Orange Theme Green Theme Red Theme
 
Home | Forums | Videos | Advertise | Certifications | Downloads | Blogs | Interviews | Jobs | Beginners | Training
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
Team Foundation Server Hosting
Search :       Advanced Search »
Home » C# Language » Chapter 2: Creating Versatile Types

Chapter 2: Creating Versatile Types

This chapter is all about making your own objects as useful and versatile as possible. In many cases, this means implementing the standard interfaces that .NET provides or simply overriding base class methods.

Technologies: C# Language
Author Name: Ben Watson
Total downloads : 0
Total page views :  12270
Rating :
 4/5
This article has been rated :  1 times
  Add to Technorati Add to Technorati    Digg This Digg This    Add to del.icio.us Add to del.icio.us
    Rate this article Read/Post comments Support Us   Printable Version 

Chapter Contents
1. Introduction
2. Format a Type with ToString()
3. Format a Type with ToString() (cont...)
4. Make Types Equatable
5. Make Types Hashable with GetHashCode()
6. Make Types Sortable
7. Give Types an Index
8. Notify Clients when Changes Happen
9. Overload Appropriate Operators
10. Convert One Type to Another
11. Prevent Inheritance
12. Allow Value Type to Be Null

DevExpress Free UI Controls
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 

Whenever you create your own classes, you need to consider the circumstances under which they could be used. For example, will two instances of your Item struct ever be compared for equality? Will your Person class need to be serializable, or sortable?

NOTE: Versatility means being able to do many things well. When you're creating your own types, it means outfitting your objects with enough "extra" stuff that they can easily be used in a wide variety of situations.

This chapter is all about making your own objects as useful and versatile as possible. In many cases, this means implementing the standard interfaces that .NET provides or simply overriding base class methods.

Total Pages : 12 12345


        Rate this article Read/Post comments Support Us   Printable Version
 Book Detail
Book Title : C# 4.0 How-To
Author: Ben Watson
Publisher: SAMS Publishing
Price: 35.99 US$
EBook Price: 28.79 US$
Publisher Home Page: http://www.samspublishing.com
Book Url: http://www.informit.com/store/product.aspx?isbn=9780672330636
 Post a new question or comment about this article
Subject:
Comment:
 [Top] Rate this article:-
Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
Latest Comments:
Subject Posted By Posted On
Support Us
Tell your friends about us
Is this article is a Bad Submission report us here
Submit articles, tutorials, and tips
Help by answering questions on our discussion forums
Help us correct errors and broken links
Looking for a job? Post your resume here
Looking for developers? Post your job here

Nevron Chart
 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.