Monday, 15 July 2013

c# - Are the .NET framework libraries considered to be user-defined? -


The C # documentation makes a fair use of the word "user-defined" for example:

can not be executed as operator ... the user defined conversion ...

Although I have not received formally definition, I believe that C # In the language specification not is user-defined

that said, I initially thought that the user defined Anything made from language (as opposed to being a part of language), but it can not keep the water, because it is possible to implement the C # compiler.

It looks like int and double are not user-defined; This is less obvious, however, with string and date time .

Anything that is part of the framework libraries but not part of C #? Yuval's answer indicates that framework libraries are not user-defined, while Patrick's answer indicates that they are.

is:

Note that as an operator only Context conversion, faucet conversion and boxing adaptation occur. Other transformations can not be made in the form of operators, such as user-defined conversion, which should be done using a cast expression.

In this case, the user-defined conversion is a conversion that is not handled by the language. For example, language handles conversions between numerical types. Those conversions are made in the compiler, and they are very complex, because they do not reflect the 'normal' behavior of the language (from now on they have created it).

In those cases, the compiler, you need to make yourself an artist as explained, you can use a conversion operator for it.

And to answer a straightforward question: Yes .NET Framework libraries are considered user-defined.


No comments:

Post a Comment