-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
internal class Command : WeakReference |
Should use "System.Windows.Forms.Command" in assembly "System.Windows.Forms".
Simple code:
internal class Command : IDisposable
{
private static readonly Type CommandType = typeof(Control).Assembly.GetType(typeof(Command).FullName);
private static readonly Reflection.PropertyInfo CommandIDProperty = CommandType.GetProperty(nameof(ID), typeof(Int32));
private static readonly Reflection.MethodInfo CommandDisposeMethod = CommandType.GetMethod(nameof(Dispose), Type.EmptyTypes);
private readonly Object cmd;
public Command(ICommandExecutor target) => this.cmd = Activator.CreateInstance(CommandType, target);
public Int32 ID => (Int32)CommandIDProperty.GetValue(this.cmd);
public void Dispose() => CommandDisposeMethod.Invoke(this.cmd, null);
}
jonaskohl
Metadata
Metadata
Assignees
Labels
No labels