Skip to content

BHoM_Engine: make TryRunExtensionMethod look into all method arguments when binding #3424

Closed
@pawelbaran

Description

@pawelbaran

Description:

Currently when trying to bind methods as a part of TryRunExtensionMethod (ExtensionMethodToCall more specifically), we only match the 1st method argument to the most applicable method signature. That means that if we declare the following method:

public static void DoNothing(this Bar bar, double number)
{
}

The following call would bind:

Bar bar = new Bar();
double number = 123;
bar.TryRunExtensionMethod("DoNothing", new object[] { number });

However, if we add the following:

public static void DoNothing(this Bar bar, object obj)
{
}

The call to bar.TryRunExtensionMethod("DoNothing", new object[] { number }); will not bind because there will be two extension methods taking Bar.

Following the above example, more sensitivity to other method arguments would be welcome, essentially treating them as if they were cast dynamically.

FYI @alelom @IsakNaslundBh

Metadata

Metadata

Assignees

Labels

type:featureNew capability or enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions