zoukankan      html  css  js  c++  java
  • C#标记符

    Fields allow the following modifiers:

    • Static modifier static
    • Access modifiers public internal private protected
    • Inheritance modifier new
    • Unsafe code modifier unsafe
    • Read-only modifier readonly
    • Threading modifier volatile

    The readonly modifier
    The readonly modifier prevents a field from being modified after construction. A read-only field can be assigned only in its declaration or within the enclosing type’s constructor.
    Field initialization
    Field initialization is optional. An uninitialized field has a default value (0, \0, null, false). Field initializers run before constructors:

    • public int Age = 10;

    Declaring multiple fields together
    For convenience, you may declare multiple fields of the same type in a commaseparated list. This is a convenient way for all the fields to share the same  attributes and field modifiers. For example:

    • static readonly int legs = 8,
    • eyes = 2;

    Methods allow the following modifiers:

    • Static modifier static
    • Access modifiers public internal private protected
    • Inheritance modifiers new virtual abstract override sealed
    • Partial method modifier partial
    • Unmanaged code modifiers unsafe extern

    Instance constructors allow the following modifiers:

    • Access modifiers public internal private protected
    • Unmanaged code modifiers unsafe extern

    You can pass an expression into another constructor as follows:

    • public Wine (decimal price, DateTime year) : this (price, year.Year) { }
  • 相关阅读:
    如何通过转换例程加减前导0
    PA教材提纲 TAW12-2
    Web开发框架趋势
    ASP.NET MVC
    一步步实现Promise
    在Jenkins中使用Git Plugin访问Https代码库失败的问题
    5年从DBA到运维架构总监 — 做对了什么
    Hello又大了一岁
    JavaWeb限流QPS简易框架
    JAVA异常使用_每个人都曾用过、但未必都用得好
  • 原文地址:https://www.cnblogs.com/henyihanwobushi/p/2591180.html
Copyright © 2011-2022 走看看