X hits on this document

936 views

0 shares

0 downloads

0 comments

132 / 396

Chapter ‎18   Unsafe code

If T1 is short and T2 is ushort, uint, or ulong, C1 is the better conversion.

If T2 is short and T1 is ushort, uint, or ulong, C2 is the better conversion.

If T1 is int and T2 is uint, or ulong, C1 is the better conversion.

If T2 is int and T1 is uint, or ulong, C2 is the better conversion.

If T1 is long and T2 is ulong, C1 is the better conversion.

If T2 is long and T1 is ulong, C2 is the better conversion.

Otherwise, neither conversion is better.

If an implicit conversion C1 is defined by these rules to be a better conversion than an implicit conversion C2, then it is also the case that C2 is a worse conversion than C1.

7.4.3 Function member invocation

This section describes the process that takes place at run-time to invoke a particular function member. It is assumed that a compile-time process has already determined the particular member to invoke, possibly by applying overload resolution to a set of candidate function members.

For purposes of describing the invocation process, function members are divided into two categories:

Static function members. These are instance constructors, static methods, static property accessors, and user-defined operators. Static function members are always non-virtual.

Instance function members. These are instance methods, instance property accessors, and indexer accessors. Instance function members are either non-virtual or virtual, and are always invoked on a particular instance. The instance is computed by an instance expression, and it becomes accessible within the function member as this (§‎7.5.7).

The run-time processing of a function member invocation consists of the following steps, where M is the function member and, if M is an instance member, E is the instance expression:

If M is a static function member:

The argument list is evaluated as described in §‎7.4.1.

M is invoked.

If M is an instance function member declared in a value-type:

E is evaluated. If this evaluation causes an exception, then no further steps are executed.

If E is not classified as a variable, then a temporary local variable of E’s type is created and the value of E is assigned to that variable. E is then reclassified as a reference to that temporary local variable. The temporary variable is accessible as this within M, but not in any other way. Thus, only when E is a true variable is it possible for the caller to observe the changes that M makes to this.

The argument list is evaluated as described in §‎7.4.1.

M is invoked. The variable referenced by E becomes the variable referenced by this.

If M is an instance function member declared in a reference-type:

E is evaluated. If this evaluation causes an exception, then no further steps are executed.

The argument list is evaluated as described in §‎7.4.1.

If the type of E is a value-type, a boxing conversion (§‎4.3.1) is performed to convert E to type object, and E is considered to be of type object in the following steps. In this case, M could only be a member of System.Object.

Copyright Microsoft Corporation 1999-2003. All Rights Reserved.119

Document info
Document views936
Page views936
Page last viewedWed Dec 07 22:41:10 UTC 2016
Pages396
Paragraphs9401
Words133190

Comments