[Mono-list] Embedded API: Method signature for ObjectSet<TEntity>.AddObject
jonathan at mugginsoft.com
jonathan at mugginsoft.com
Tue Nov 19 11:39:17 UTC 2013
On 18 Nov 2013, at 23:17, jonathan at mugginsoft.com wrote:
> I cannot get the embedded method signature for the following method quite right:
>
> ObjectSet<TEntity>.AddObject Method
> public void AddObject(TEntity entity)
> http://msdn.microsoft.com/en-us/library/dd487277(v=vs.110).aspx
>
Insight strikes after reading http://mono.1490590.n4.nabble.com/Obtaining-a-generic-MonoMethod-td1497087.html
I am calling the method on an instantiated (or inflated) instance of a generic class.
So I need to include the actual object type in the signature in place of the generic parameter TEntity
- (void)addObject:(DBMonoObjectRepresentation *)object
{
NSString *inflatedMethodName = [NSString stringWithFormat:@"AddObject(%s)", [[object class] monoClassName]];
DBMonoMethodRepresentation *methodRep = [DBMonoMethodRepresentation
representationWithMonoMethodNamed:[inflatedMethodName UTF8String]];
[self invokeMethodRepresentation:methodRep withNumArgs:1, [object monoObject]];
}
My mistake as the following:
I have generic method detection code that automatically inflates generic methods with actual types.
However, the above is not a generic method (correct me if I am wrong please!) as it is not declared with type parameters like so: void Swap<T>(ref T lhs, ref T rhs)
And IsGenericMethod does indeed return false for the above method.
Jonathan
More information about the Mono-list
mailing list