简体   繁体   中英

FixedPage Class and IEnumerable

I have a FixedPage class as follows

        PageContent pageContent = new PageContent();
        FixedPage fixedPage = new FixedPage();
        double pageWidth = 96 * 8.5;
        double pageHeight = 96 * 11;
        fixedPage.Width = pageWidth;
        fixedPage.Height = pageHeight;
        Size sz = new Size(8.5 * 96, 11 * 96);
        fixedPage.Measure(sz);
        fixedPage.Arrange(new Rect(new Point(), sz));
        fixedPage.UpdateLayout();

        ((IAddChild)pageContent).AddChild(fixedPage);

and an IEnumerable object as follows

IEnumerable<FixedPage> page;
page.Concat(new[] { fixedPage });

in the line

page.Concat(new[] { fixedPage });

Its showing error as

'Use of unassigned local variable 'page''

How can I assign fixedPage to page?

I also need help to create a fixedPage object(elements)

您应该通过创建一个实现IEnumerable接口的类的新实例来初始化页面变量,例如通用List类:

IEnumerable<FixedPage> page = new List<FixedPage>(new FixedPage[] { fixedPage });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM