Get special object types (type. GetType)

Source: Internet
Author: User

Generally, we can obtain object types using the following methods:

String vtypename = "system. int32 ";

Type vtype = type. GetType (vtypename );

Type vtype1 = typeof (INT );

 

However, when an assembly is dynamically loaded and used in another assembly, the results may differ.

Assembly vassembly = assembly. LoadFile (vdllfilename );

The custom data type is [tempuri.org. linearring].

If we directly use type. GetType ("tempuri.org. linearring"), no data is obtained.

You must use the following methods:

Type vtype2 = vassembly. GetType ("tempuri.org. linearring ");

String vtypestring = string. format ("system. collections. generic. list '1 [[{0}] ", vtype2. assemblyqualifiedname); // This statement contains the dynamic link library information. Otherwise, the type information cannot be obtained using vtype2.fullname.

Type vtype3 = passembly. GetType (vtypestring );

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.