home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples.exe / QuickStart / howto / doc / compare.aspx < prev    next >
Encoding:
Text File  |  2000-05-31  |  1.6 KB  |  41 lines

  1.  
  2. <!-- #include virtual="/quickstart/howto/include/header.inc" -->
  3.  
  4. <h4>How Do I...Compare the value of two objects?</h4>
  5.  
  6. <div class="indent" style="width:660">
  7. This sample illustrates how to compare almost any two values. 
  8. This is done by leveraging the IComparable interface that all 
  9. the base types implement. The Max method shown below returns 
  10. the maximum of any two values that implement IComparable. Because 
  11. all of the base types (int, double, sting, etc) implement IComparable, 
  12. this method works with all of them. The CompareTo method on IComparable 
  13. has the following return values: < 0 if value is less than the current 
  14. instance, == 0 if value is equal to the current instance,
  15.  > 0 if value is greater than the current instance. We also show 
  16.  a custom implementation of IComparable. 
  17. </div>
  18.  
  19. <h4>Example</h4>
  20.  
  21. <p>
  22. <div class="indent">
  23. <a target="_blank" href="<%=Server.MapPath("/quickstart/howto/samples/BaseDataTypes/compare")%>">
  24. <img style="border-color:black" border=1 src="/quickstart/images/genicon.gif"><br>
  25. </a>
  26. <div class="caption">Compare.exe</div><br>
  27. [<a target="_blank" href="<%=Server.MapPath("/quickstart/howto/samples/BaseDataTypes/compare")%>">View Sample</a>] | 
  28. [<a target="_blank" href="/quickstart/util/srcview.aspx?path=/quickstart/howto/samples/BaseDataTypes/compare/compare.src">View Source</a>]<p>
  29. </div>
  30.  
  31. <h4>Source Code</h4>
  32.  
  33. <div class="code">
  34. <xmp>
  35.  
  36. <!-- #include virtual="/quickstart/howto/samples/BaseDataTypes/Compare/compare.cs" -->
  37.  
  38. </xmp>
  39. </div>
  40.  
  41. <!-- #include virtual="/quickstart/howto/include/footer.inc" -->