在 C# 中,如何在使用通用类型时抑制自定义 CodeActivity 中的弹出窗口?

问题描述

我在 C# 中有一个 ReHosted 工作流设计器,并且我有一个具有通用类型的自定义活动。 为了更好地理解它,我在 here 中找到了 psycopg2 活动。 并将其复制到我的代码中:

AddToCollection<>

当我在设计器中放入 Microsoft 的代码时,它不会显示泛型类型的弹出窗口,而是将其显示[contentproperty("Collection")] public sealed class AddToCollection<T> : CodeActivity { [requiredArgument] [DefaultValue(null)] public InArgument<ICollection<T>> Collection { get; set; } [requiredArgument] [DefaultValue(null)] public InArgument<T> Item { get; set; } protected override void CacheMetadata(CodeActivityMetadata Metadata) { Collection<RuntimeArgument> arguments = new Collection<RuntimeArgument>(); RuntimeArgument collectionArgument = new RuntimeArgument("Collection",typeof(ICollection<T>),ArgumentDirection.In,true); Metadata.Bind(this.Collection,collectionArgument); arguments.Add(collectionArgument); RuntimeArgument itemArgument = new RuntimeArgument("Item",typeof(T),true); Metadata.Bind(this.Item,itemArgument); arguments.Add(itemArgument); Metadata.SetArgumentsCollection(arguments); } protected override void Execute(CodeActivityContext context) { ICollection<T> collection = this.Collection.Get(context); T item = this.Item.Get(context); collection.Add(item); } } ,如下所示:

enter image description here

但是当我在上面复制和粘贴的代码时,它会显示一个弹出窗口并询问我的类型,并且在属性部分中没有显示 InArgument,如下所示:

enter image description here

不想弹出第二张照片中的弹出窗口,并在我的其他自定义活动中使用第一张照片中的相同内容。 我怎么做?我错过了什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)