字段类型比字段更难访问
Field type is less accessible than field
我有以下声明:
public static class Helper
{
public static Func<T1,T2, string> myFunc = (t1, t2) =>
{
var result = string.Empty
//do some things with params t1 and t2, and build a string
return result
};
}
我是这样吃的:
var myString = Helper.myFunc(t1, t2);
在另一个 class。
它不编译,它说 "Inconsistent accesibility: field type ... is less accessible than field Helper.myFunc"
我明白是和匿名声明有关,但是怎么解决呢?
检查 T1 和 T2 是否也可以在此代码中访问
var myString = Helper.myFunc(t1, t2);
我有以下声明:
public static class Helper
{
public static Func<T1,T2, string> myFunc = (t1, t2) =>
{
var result = string.Empty
//do some things with params t1 and t2, and build a string
return result
};
}
我是这样吃的:
var myString = Helper.myFunc(t1, t2);
在另一个 class。 它不编译,它说 "Inconsistent accesibility: field type ... is less accessible than field Helper.myFunc" 我明白是和匿名声明有关,但是怎么解决呢?
检查 T1 和 T2 是否也可以在此代码中访问
var myString = Helper.myFunc(t1, t2);