func< string,string,bool>不是有效的Windows运行时参数类型(Win 8.1) [英] func<string,string,bool> is not a valid windows runtime parameter type (win 8.1)

查看:125
本文介绍了func< string,string,bool>不是有效的Windows运行时参数类型(Win 8.1)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

https://github.com/igorkulman/AutoCompleteBox/blob/master/AutoCompleteBox/AutoCompleteBox.cs

我下载了此控件,但无法构建它,

public Func<string, string, bool> SearchFunction
{
   get { return (Func<string, string, bool>)GetValue(SearchFunctionProperty); }
   set { SetValue(SearchFunctionProperty, value); }
}

当我尝试以公共方式使用SearchFunction时,出现此错误.当我将其更改为内部时,它可以工作,但是这次我无法从项目中访问SearchFunction.

Method 'CodeAutoComplete.AutoCompleteBox.SearchFunction.get()' has a parameter of type
 'System.Func<System.String, System.String, System.Boolean>' in its signature. Although 
this generic type is not a valid Windows Runtime type, the type or its generic parameters 
implement interfaces that are valid Windows Runtime types. Consider changing the type 
'System.Func<T1, T2, TResult>' in the method signature. It is not a valid Windows Runtime 
parameter type. C:\\..CodeAutoComplete\AutoCompleteBox.cs CodeAutoComplete (Windows 8.1)

我该怎么办?

解决方案

不是将文件添加到WindowsRuntimeComponent项目中,而是将其添加到Windows存储类库中(如果您已经创建了项目,则可以将输出类型更改为class库,位于项目属性->输出类型中.
问题是,如果您创建WindowsRuntime组件,您是https://github.com/igorkulman/AutoCompleteBox/blob/master/AutoCompleteBox/AutoCompleteBox.cs

I download this control, But I cannot build it,

public Func<string, string, bool> SearchFunction
{
   get { return (Func<string, string, bool>)GetValue(SearchFunctionProperty); }
   set { SetValue(SearchFunctionProperty, value); }
}

When I try using SearchFunction as public,I am getting this error. When I change it as internal it is working but this time I can't access SearchFunction from my project.

Method 'CodeAutoComplete.AutoCompleteBox.SearchFunction.get()' has a parameter of type
 'System.Func<System.String, System.String, System.Boolean>' in its signature. Although 
this generic type is not a valid Windows Runtime type, the type or its generic parameters 
implement interfaces that are valid Windows Runtime types. Consider changing the type 
'System.Func<T1, T2, TResult>' in the method signature. It is not a valid Windows Runtime 
parameter type. C:\\..CodeAutoComplete\AutoCompleteBox.cs CodeAutoComplete (Windows 8.1)

What should I do?

解决方案

Instead of adding the file to a WindowsRuntimeComponent project, add it to Windows store class library (if you have already created the project you can change the output type to class library in project properties->Output type).
The problem is if you create a WindowsRuntime component, you are a lot more limited in what you can make public as everything you make public need to have a valid WindowsRuntime type mapping.

这篇关于func&lt; string,string,bool&gt;不是有效的Windows运行时参数类型(Win 8.1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆