Reputation: 5567
We are binding a library from Objective C to C#. We want to use different names in our classes in C#.
Do the class in C# and the objective C class must have the same name?
I know that using the MonoTouch.Foundation.ExportAttribute in the methods in C# we can specify different names for the methods and properties... however, I haven't found how to do the same for classes.
Thanks.
Upvotes: 4
Views: 196
Reputation: 43553
Yes, you can specify your own type name byt specifying a Name
property to the [BaseType]
attribute. E.g.
[BaseType (typeof (NSObject), Name="NSURL")]
public interface NSUrl {
}
That, real life, example allows you to use NSUrl
in C# instead of the Objective-C NSURL
type name. You can see many more examples, like the one above, in github.
Upvotes: 5