C # Generic

Source: Internet
Author: User
C #2.0 generic has been available for a long time. I believe you have a lot of knowledge about it.
The concise syntax and the limitation of where make it look more elegant than the C ++ template. However, due to the limitations of the C # compiler itself, it is probably not competent for generic programming methods like Loki. The biggest restriction is that a class cannot be inherited from its template class, similar to the following Code Public   Class Foo < T > : T
{

This cannot be compiled in C #2.0. This technique is the basic usage of policy in C ++ generic programming.
Another important technology in C ++ generic progrmming is partial specialization. This is not supported in C #2.0. At most, you can obtain similar functions from function overloading.
In general, C #2.0 generics are slightly more comfortable than java1.5, especially when runtime reflection is used to obtain complete generic information about the code, this should be a major advantage.

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.