C # Object-oriented fragmented knowledge points

Source: Internet
Author: User

Obgect:

All data types are obgect types;

Universal type var: the original variable is unchanged and replaced with Var;

Dynamic type: Like object, traversal needs to go;

is as:

type conversion operators;

(Type) object: Cast, if the conversion is unsuccessful, there will be an exception;

ArrayList arr = new ArrayList ();

Arr. ADD ();

foreach (Obgect o in arr)

{

If (O is Random)

{

Random r = (random) o;

Console.WriteLine (R.next (1,11));

}

}

is to determine whether an object or variable is a type that returns a bool;

ArrayList arr = new ArrayList ();

Arr. ADD ();

foreach (Obgect o in arr)

{

Random r = o as Random;

if (r! = null)

Console.WriteLine (R.next (1,11));

}

As type conversion if an object can be converted to a type, then he will convert;

If it cannot be converted to a type, NULL is returned and no error is made;

Universal variable var

Dynamically typed dynamic

generic type <t>:
Generic collection

Fixed type, not fixed length;

List<int> ABC = new list<int>;

Abc. Count ();


Class Library:

Commissioned:

Delegate

C # Object-oriented fragmented knowledge points

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.