C # The extension method is signed for the objective-C extension class.

Source: Internet
Author: User

Author: failingProgramMember-eight gods

C # demonstrates the features and functions of multiple languages. The following describes the extension methods introduced from objective-C.

The following example demonstrates an extension method defined in C # For the system. string class:

 

 
Namespace extensionmethods {public static class myextensions {public static int wordcount (this string Str) {return Str. Split (New char [] {'', '.', '? '}). Length ;}}}

 

In objective-C, the extension class method can also implement the same function:

 

 
@ Interface nsstring (myextensions) @ property (nonatomic, readonly) int wordcount; @ end @ implementation nsstring (myextensions)-(INT) wordcount {return [self defined: [nscharacterset charactersetwithcharactersinstring: @",.? "];}

 

This is really an interesting thing. Bill and Steve Jobs are two extremes of mutual fire. They both hate each other very much. no products of the other party will appear in each other's home, but there is a shadow in platform development.

Now I like developing with objective-C rather than using any mono product. The latter provides C # development methods for Android and iOS platforms, but the price is not cheap.

However, xcode's debugging tracking function is not as powerful as Visual Studio, but its installation file must not be smaller than the latter.

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.