C#修饰符

1.set vector and get vector is needed in CSharp programing.

2.readonly is different from const.

for example:

Class Myclass

{const int a=10;//this paramater can't be changed any more

readonly int b=10;//this paramater can't be changed.too

readonly int c;//c can be initialed in the futrue.

 public Myclass

      {

      c=8;//c 

      }

public func()

    {

      a=9;//error!

     }

}

3.sealed method

  the class which is modified with code"sealed" will not be Inherited,so if you want that one class can't be inherited,you can take use of key words"sealed".

4.unsafe

   you can apply key word"unsafe" to modify a unsafe article.In the unsafe article you can try to insert some dangerous codes,such as C++ pointer.look at the reference as following:

   public unsafe myfunction(int *pointer1,double* pDouble)

     { int* pint=new int;

      *pint=10;

       pointer1=point;

      ..........

    }

 

posted on 2012-05-24 16:21  .ne菜鸟  阅读(137)  评论(0编辑  收藏  举报

导航