Steps:
- Create one Console App (net 8)
- Add Packages:
<PackageReference Include="DryIoc.dll" Version="5.4.3" />
- Code:
public abstract class A;
public class A1 : A;
internal class Program
{
static void Main(string[] args)
{
var container = new Container();
container.Register<object, A1>(serviceKey: "A1");
var decorateMethod = typeof(Program).SingleMethod(nameof(DecoratorA), true);
container.Register<object>(made: Made.Of(r => decorateMethod),
setup: Setup.DecoratorOf<A>());
var res = container.Resolve<object>("A1", args: [ DateTime.Now ]);
//res is DateTime
}
private static object DecoratorA(object t)
{
//t is DateTime
return t;
}
}
Why is the parameter t of the incoming method DecoratorA in this case of type DateTime?
The above code may seem strange, but in Prism, the View is registered as object, so here's an example of the easiest way to reproduce it.
Steps:
Why is the parameter
tof the incoming methodDecoratorAin this case of typeDateTime?The above code may seem strange, but in Prism, the View is registered as
object, so here's an example of the easiest way to reproduce it.