zoukankan      html  css  js  c++  java
  • c# 基础

    freature of c#
      Assembly Versioning
      Properties and Events
      Delegates and Events Management
      Indexers
      Conditional Compilation
      Simple Multithreading
      LINQ and Lambda Expressions

    namespace

      There is no package, but nested namespace instead.

    namespace outer
    {
    namespace inner
    {
        class Demo
        {
            // some code here
        }
    }
    }

    value type

      to get exact size of a type of variable, you can use sizeof method.

    reference type

      object type

        the object type can be assigned values of any other types,
        value type
        reference type
        or user-defined type


        object obj;
        obj = 100; // this is boxing

      dynamic type
        you can store any type of value in the dynamic data type variable.
        type checking takes place at run-time.

        dynamic <variable_name> = value;
        dynamic d = 20;

        the difference between dynamic type and object type is the time when type checking takes place.
        former's type type checking takes place at run-time.
        later's type type checking takes place at compile time.

      string

        The string type is an alias for the System.String class.
        It is derived from object type.
        There are two forms:
          quoted
          @quoted

    pointer type
      pointer in c# have the same capabilities as the pointers in c or c++.
      we will discuss pointer types as unsafe codes.

    lvalue: An expression that is an lvalue may appear as either the left-hand or right-hand side of an assignment.

    rvalue: An expression that is an rvalue may appear on the right- but not left-hand side of an assignment.

    array

    double[] balance = new double[10];
    for (int i = 0; i < 10; i++)
    {
        balance[i] = i;
    }
    foreach (double d in balance)
    {
        Console.WriteLine(d + "
    ");
    }

    structures in c#

    struct Books
    {
        public string title;
        public string author;
        public string subject;
        public int book_id;
    };

    class versus struct
      *classes are reference types and structs are value types
      structures do not support inheritance
      structures cannot have default constructor

    c# has preprocessor directives like in c or c++.

    exception handling
      try
      catch
      finally
      throw

    以上内容均来自 https://www.tutorialspoint.com/csharp/ 

  • 相关阅读:
    iOS UITableView的cell重用标识
    iOS SDWebImage清理缓存数据
    iOS UITextView 根据输入text自适应高度
    iOS 网络请求 NSURLSession 的上传文件方法
    iOS开发之tintColor属性详解
    iOS SDWEBImage和collectionView的组合,以及collectionView的随意间距设置
    iOS9 Xcode7 设置Launch Image 启动图片
    iOS
    iOS 浅谈AFNetworking网络请求
    贝塞尔曲线
  • 原文地址:https://www.cnblogs.com/wendellyi/p/6169161.html
Copyright © 2011-2022 走看看