Definition of a method signature?

前端 未结 7 1915
萌比男神i
萌比男神i 2020-12-08 10:32

What is the correct definition of a method signature (or a signature of a method)?

On google, I find various definitions:

It is the combinatio

7条回答
  •  眼角桃花
    2020-12-08 11:06

    Section 3.6 of the C# Language Specification (v 4.0) provides the most precise answer regarding method signatures:

    The signature of a method consists of the name of the method, the number of type parameters and the type and kind (value, reference, or output) of each of its formal parameters, considered in the order left to right. For these purposes, any type parameter of the method that occurs in the type of a formal parameter is identified not by its name, but by its ordinal position in the type argument list of the method. The signature of a method specifically does not include the return type, the params modifier that may be specified for the right-most parameter, nor the optional type parameter constraints.

提交回复
热议问题