How to write the Xml based document

image_pdfimage_print
   
  
using System;
using System.Collections.Generic;
using System.Text;

namespace XmlDocCar
{
    /// <summary>
    ///  This is a simple Car.
    /// </summary>
    public class Car
    {
        /// <summary>
        /// Do you have a sunroof?
        /// </summary>
        private bool hasSunroof = false;

        /// <summary>
        /// The ctor lets you set the sunroofedness.
        /// </summary>
        /// <param name="hasSunroof"></param>
        public Car(bool hasSunroof)
        {
            this.hasSunroof = hasSunroof;
        }

        /// <summary>
        /// This method allows you to open your sunroof.
        /// </summary>
        /// <param name="state"> </param>
        public void OpenSunroof(bool state)
        {
            if (state == true &amp;&amp; hasSunroof == true)
                Console.WriteLine("has sub roof!");
            else
                Console.WriteLine("you don&#039;t have a sunroof.");
        }
    }
}

   
     


XML Documentation: Compiler Support Tags

image_pdfimage_print
   
 
using System;

namespace Payroll
{
    
    /// <summary> 
    /// Comments for the class
    /// This class class contains a <see cref="String">string</see>
    /// </summary>
    public class Employee
    {
        /// <summary>
        /// Constructor for an Employee instance. Note that
        /// <paramref name="name">name2</paramref> is a string.
        /// </summary>
        /// <param name="id">Employee id number</param>
        /// <param name="name">Employee Name</param>
        public Employee(int id, string name)
        {
            this.id = id;
            this.name = name;
        }
        
        /// <summary>
        /// Parameterless constructor for an employee instance
        /// </summary>
        /// <remarks>
        /// <seealso cref="Employee(int, string)">Employee(int, string)</seealso>
        /// </remarks>
        public Employee()
        {
            id = -1;
            name = null;
        }
        int id;
        string name;
    }
}

           
         
     


Use summary element

image_pdfimage_print
   
  
namespace SimpleXML
{
    /// <summary>
    /// Summary description for Class1.
    /// </summary>
    class Class1
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args) {}
   
        /// <summary>
        /// This method does something interesting.
        /// </summary>
        public static void Foo() {}
    }
}

   
     


A version representing '2.0' does not equal a version representing '2.0.0.0'.

image_pdfimage_print
   
 

using System; 

namespace Samples
{
    class Program
    {
        static void Main(string[] args)
        {
            Version version1 = new Version(2, 0);
            Version version2 = new Version(2, 0, 0);
            Version version3 = new Version(2, 0, 0, 0);
            Console.WriteLine(version1.Equals(version2));
            Console.WriteLine(version1.Equals(version3));
            Console.WriteLine(version2.Equals(version3));
        }
    }
}