public partial class Device : MarshalByRefObject
{
internal bool FindTagName(string name, OneTag tag)
{
foreach (FuncSect fs in listFuncSect)
{
foreach (OneTag ot in fs.listTags)
{
if (ot != tag && ot.Name == name) return true;
}
}
return false;
}
仍然不知道如何将这个“部分”和“内部”转换为 F#
谢谢
正如leppie所说,没有直接支持partial
,尽管你可以达到类似的效果内在类型扩展。 F# 确实支持internal
方法,所以你的例子看起来像:
// primary definition somewhere
type Device() =
inherit MarshalByRefObject()
...
// type extension (roughly equivalent to partial class)
type Device with
member internal this.FindTagName(name:string, tag:OneTag) =
listFuncSect
|> Seq.exists
(fun fs ->
fs.listTags
|> Seq.exists (fun ot -> ot <> tag && ot.name = name))
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)