C # basic usage of generic and assembly (deleteenth Day)

Source: Internet
Author: User

C # basic usage of generic and assembly (deleteenth Day)
Today, I am mainly studying generics, assembly, and the use of some broken knowledge. Next I will summarize what I have learned today. Theory: generics: * The English name is Generic, which allows multiple types to share a set of code. Generics allow us to declare type parameterization and instantiate with different types, that is, you can use a type placeholder to create the concept of a specific type value. * C # provides five generic types: Class, structure, interface, delegate, and method. Today, I will learn more about generic delegation and generic interfaces. * The constraints of generics cannot be numerical values. * When defining a method, we are used to append a number to the array using the method name Push. Similarly, the method name Pop is used to delete a number from the array, it is often deleted from the last array. * The reason why the array can be recycled by Foreach is that an enumerator in the array returns each element in the request array in sequence. * If a class implements the IEnumerable interface, it can implement the GetEnumerator method in the interface. The class with this method is called the enumerable class, And the array is the enumerable type. An assembly * With the extension name of .exe and. dll is called an assembly. GAC Global Assembly Cache * each computer installed with a public language runtime has a code cache within the computer called the Global Assembly Cache. * The Global Assembly cache stores an assembly that is specially designated to be shared by several applications on the computer. The Assembly should be installed to the Global Assembly Cache for sharing only when necessary. * The general principle is that the Assembly dependency is dedicated and located in the application directory unless explicitly required to share the assembly. In addition, you do not need to install the assembly to the Global Assembly Cache to allow COM interoperability or unmanaged code to access the assembly. The anonymous class does not have a specific type, so var is used to receive it. It can only be used in the method body for example: var person = new {name = "Zhang San ", age = 18} the extension method must be a static class with an access break. Here, the extension method is added for the object, so the object is written here. example: public static Myob (this object o, string content ){.......} the Application of generic delegation converts lowercase strings to uppercase strings, and uses generic delegation to define a generic delegate Func

Related Article

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.