Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
F# 实现内部抽象成员_F#_Mono - Fatal编程技术网

F# 实现内部抽象成员

F# 实现内部抽象成员,f#,mono,F#,Mono,抽象类(在本例中为System.Reflection.MethodBase)需要实现整个接口,这很好。但它有一个抽象的成员: internal abstract ParameterInfo[] GetParametersInternal (); 而F#编译器抱怨: 没有为“MethodBase.GetParametersInternal()提供实现: ParameterInfo[]' 我如何实现这个我无权访问的内部成员?或者干脆忽略这一点,实施公共成员 如果我确实尝试强制执行覆盖: overr

抽象类(在本例中为System.Reflection.MethodBase)需要实现整个接口,这很好。但它有一个抽象的成员:

internal abstract ParameterInfo[] GetParametersInternal ();
而F#编译器抱怨:

没有为“MethodBase.GetParametersInternal()提供实现: ParameterInfo[]'

我如何实现这个我无权访问的内部成员?或者干脆忽略这一点,实施公共成员

如果我确实尝试强制执行覆盖:

override this.GetParametersInternal() = parameters |> List.toArray
我得到:

未找到与此对应的抽象或接口成员 覆盖


不能重写此memeber-内部成员仅对同一程序集中的类型可见
MethodBase
是在mscorlib中定义的,因此
GetParametersInternal
仅对该程序集中的其他类型可见,而您的代码则不可见。

您不能重写此Member-内部成员仅对同一程序集中的类型可见
MethodBase
是在mscorlib中定义的,因此,
GetParametersInternal
仅对该程序集中的其他类型可见,而您的代码不可见。

正如Lee所说,您不应该能够从另一个程序集中重写内部成员。在执行基本继承时,我没有看到任何编译器错误-下面的编译很好:

type MyMethodBase() = 
    inherit System.Reflection.MethodBase()
    override this.Attributes with get () = failwith ""
    override this.GetMethodImplementationFlags() = failwith ""
    override this.GetParameters() = failwith ""
    override this.Invoke(obj, invokeAttr, binder, parameters, culture) = failwith ""
    override this.MethodHandle with get() = failwith ""
    override this.DeclaringType with get() = failwith ""
    override this.GetCustomAttributes(attributeType, inh) = failwith ""
    override this.GetCustomAttributes(b) = failwith ""
    override this.IsDefined(attributeType, inh) = failwith ""
    override this.MemberType with get() = failwith ""
    override this.Name with get() = failwith ""
    override this.ReflectedType with get() = failwith ""

正如Lee所说,您不应该能够重写另一个程序集的内部成员。在执行基本继承时,我没有看到任何编译器错误-下面的编译很好:

type MyMethodBase() = 
    inherit System.Reflection.MethodBase()
    override this.Attributes with get () = failwith ""
    override this.GetMethodImplementationFlags() = failwith ""
    override this.GetParameters() = failwith ""
    override this.Invoke(obj, invokeAttr, binder, parameters, culture) = failwith ""
    override this.MethodHandle with get() = failwith ""
    override this.DeclaringType with get() = failwith ""
    override this.GetCustomAttributes(attributeType, inh) = failwith ""
    override this.GetCustomAttributes(b) = failwith ""
    override this.IsDefined(attributeType, inh) = failwith ""
    override this.MemberType with get() = failwith ""
    override this.Name with get() = failwith ""
    override this.ReflectedType with get() = failwith ""

您可能正在尝试使用类型提供程序构建F#3。 这是Mono 3.0.6中的一个错误:


它是两天前修复的,所以请等待3.0.7,除非您想自己编译Mono

您可能正在尝试使用类型提供程序构建F#3。 这是Mono 3.0.6中的一个错误:


它是两天前修复的,所以请等待3.0.7,除非您想自己编译Mono

是的,我正在使用类型提供程序。是的,它发生在3.0.6。谢谢。是的,我正在使用类型提供程序。是的,它发生在3.0.6。谢谢