home contact sitemap polish version
Client login
Email:
Password:

Logged in customers can manage projects, report errors, submit comments ...


If you don't have an account, feel free to contact us.



 Coding standards

 

  Following sample shows some of the coding rules we try to stick to:



  • Proper naming (Pascal casing):


  • public class MyClass
    {
        public const  int MyVariable = 20;
     
        public void MyMethod()
       {
           //implementation
       }  


        lub prefiks dla interfejsów:

    interface IMyInterface
    {...}
     

  • Function names based on returning values:



  • GetUserEmail();

    GetCurrentObjectState();


  • In-line Comments


  • Passing initial values in class contructor


  • Using "using statement": 



  • using MyCompany.MyProject

    using{MyClass MyObj = new MyClass(5)}
    {
        // implementation 
    }




    namespace MyCompany.MyProject
    {
        /// <summary>
        /// MyClass - klasa zawiera metody które ....
        /// </summary>
        public sealed class MyClass : IDisposable
        {

          ///<summary>
          /// Konstruktor klasy
         ///</summary>
         public MyClass() 
          {
               //implementacja
          }

           ///<summary> 
           /// Overload: Inicjalizacja obiektu z jednoczesnym przekazaniem wartości
           ///</summary>
           /// <param name="MyValue">Wartość początkowa (int)</param>
           public MyClass(int MyValue)
           {
                //implementacja
            }

       #region IDisposable - obszar destruktora

           private bool disposed = false;
           // Deklarujemy zarządzane zasoby dla tego obiektu
           private Component component = new Component();

          ///<summary>
          /// Usuwa obiekt z pamięci (disposing)
         ///</summary>
          public void Dispose()
          {
               Dispose(true);
               // Usuwamy obiekt z kolejki do destrukcji (po raz drugi)
               GC.SuppressFinalize(this);
            }
      
          ///<summary>     
          ///Sprawdzanie czy obiekt został już usunięty
          ///</summary>
           private void Dispose(bool disposing)
           {
              if (!this.disposed)
             {
                  if (disposing)
                   {
                      // Destrukcja kodu zarządzanego (managed) 
                      component.Dispose();
                  }
               }
                 disposed = true;
             }
     
       #endregion

       } //class end

    }// namespace end


    etc...

    © copyright ProXmedia 2009