문제

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;
    }

still have no idea how to convert this "partial" and "internal" to F#

thank you

도움이 되었습니까?

해결책

As leppie says, there's no direct support for partial, although you could achieve a similar effect with intrinsic type extensions. F# does support internal methods, so your example would look like:

// 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))

다른 팁

partial is a C# compiler feature, it ain't gonna work on F#, you will have to combined all the partial classes, or inherit from an existing one.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top