Xamarin class names for binding Objective-C

We bind the library from Objective-C to C #. We want to use different names in our classes in C #.

Should a class in C # and an object class C have the same name?

I know that using MonoTouch.Foundation.ExportAttribute in methods in C # we can specify different names for methods and properties ... however, I have not found how to do the same for classes.

Thanks.

+4
source share
1 answer

Yes, you can specify your own byt type by specifying the Name property for the [BaseType] attribute. For instance.

  [BaseType (typeof (NSObject), Name="NSURL")] public interface NSUrl { } 

This real-life example allows you to use NSUrl in C # instead of a type name of Objective-C NSUrl . You can see many more examples, for example above, on github .

+4
source

Source: https://habr.com/ru/post/1499040/


All Articles