F#中的接口对象语法

时间:2015-05-05 10:23:09

标签: c# syntax f#

我将多页打印的C#代码翻译成F#。有人可以告诉我如何翻译:

((IAddChild)page1Content).AddChild(page1)

上下文:

       // printdia = printdialog
       // printdoc = printdocument

       // create a page
       let page1 = new System.Windows.Documents.FixedPage()
       page1.Width <- printdoc.DocumentPaginator.PageSize.Width
       page1.Height <- printdoc.DocumentPaginator.PageSize.Height
       page1.Children.Add(printcanvas) |> ignore
       // add the page to the document
       let page1Content = new System.Windows.Documents.PageContent()
 (*C#*)((IAddChild)page1Content).AddChild(page1)
       printdoc.Pages.Add(page1Content) |> ignore
       // and print
       printdia.PrintDocument(printdoc.DocumentPaginator, ordernr.Text);

Original code in C#

0 个答案:

没有答案