Learn C # (index 2) a week

zhaozj2021-02-16  47

Learn C # (index 2) C # (QQ: 249178521)

4. Index vs. array

· Comparison of indexes and arrays

W indexing can use non-integer parameters

W index can be overloaded

W index can be private

W index cannot have a REF / OUT type parameter

Struct Matrix

{

...

Public Double this [int in, int col]

{

Get {...}

Set {...}

}

Public row this [int in]

{

Get {...}

Set {...}

}

...

}

5. Index vs. attribute

· Comparison of indexes and attributes

W is only GET and SET statements

W No static index

§ can have static properties

W index is declared at the level of the class

§ Property is declared at the level of the field

Struct row

{

...

Public Double this [INT COL]

{

Get {...}

Set {...}

}

Public int LENGTH

{

Get {...}

}

...

}

Attributes and indexes can declare in the interface.

Interface Irow

{

Double this [int index] {get; set;}

INT longth {get;

}

6. Index vs. function

· Comparison of indexes and functions

W function can have no parameters

W function can have a VOID type return value

W index can only contain GET / SET statements

转载请注明原文地址:https://www.9cbs.com/read-22150.html

New Post(0)