C #. Net Description Interface query (QI) technology in ArcObjects

Source: Internet
Author: User
In the secondary development of AO or AE, the interface query (QI) technology is considered to be the most basic and one of the most important technologies. Almost every GIS system, even a small GIS function module cannot use the interface query technology. In general, Qi is an explicit forced conversion in the class. See the following example. /*
* Created by sharpdevelop.
* User: noo
* Date: 2009-8-18
* Time:
*
* Interface query (QI)
*/

Using system;
Interface iapple // Apple Interface
{
String spice // fragrance Property
{
Get;
Set;
}
Void circle (); // Circle Method
}
Interface ibanana // banana Interface
{
String sweet // sweet Property
{
Get;
Set;
}
Void column (); // Column Method
}
Class fruit: iapple, ibanana // fruit class
{
Private string str1;
String iapple. Spice // note the writing method here
{
Get {return str1 ;}
Set {str1 = value ;}
}
Void iapple. Circle () // same as above
{
Console. writeline ("Apple interface member functions ");
}

Private string str2;
String ibanana. Sweet
{
Get {return str2 ;}
Set {str2 = value ;}
}
Void ibanana. Column ()
{
Console. writeline ("banana interface member function ");
}
}
Class Test
{
Static void main ()
{
Iapple papple = new fruit (); // instantiate the class of the Interface Type
Papple. Circle ();
Papple. Spice = "Sweet Apple ";
Console. writeline (papple. Spice );

Ibanana pbanana = new fruit ();
Pbanana. Column ();
Pbanana. Sweet = "sweet banana ";
Console. writeline (pbanana. Sweet );

Iapple PAPP = new fruit ();
Ibanana PBAN = PAPP as ibanana; // interface query (QI), which is an explicit forced conversion.
PBAN. Column ();
PBAN. Sweet = "sweet banana ";
Console. writeline (PBAN. Sweet );
}
} From the above example, we can see that Qi is actually very well mastered and its principle is very simple.

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.