On 31.08.2013 23:16, jonat...@mugginsoft.com wrote:
How is an explicit operator called using the embedded api?
For example mscorlib contains a number of explicit operators for NSDecimal:
http://msdn.microsoft.com/en-us/library/system.decimal.op_explicit.aspx
Reflection returns the operators as methods which I naively attempt to call
like so in Obj-C:
- (uint8_t)op_Explicit_withValue:(NSDecimalNumber *)p1
{
MonoObject *monoObject = [self
invokeMonoMethod:"op_Explicit(decimal)" withNumArgs:1, [p1 monoValue]];
return DB_UNBOX_UINT8(monoObject);
}
However all the operator methods will have the same signature as only the
return type differs, so how do I differentiate them?
Assuming that you're using mono_method_desc_search_in_class () for
method look-ups, there is actually no way to specify the return
type. You may want to enumerate the methods yourself using
mono_class_get_methods ().
However, what makes you think that you need these operators in the
first place? :) Decimal implements a full set of ToXyz methods which
are more readable and accessible from unmanaged code. IConvertible
is implemented as well...
Robert
_______________________________________________
Mono-list maillist - Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list