0

我正在尝试创建一个返回 XPcollection 的过程,如下所示:

    public XPCollection<Txn> RetrieveTransactions()
    {
        if (ObjectSpace is DevExpress.ExpressApp.Xpo.XPObjectSpace)
        {
            XPCollection txns = (XPCollection)ObjectSpace.CreateCollection(typeof(Txn));
            if (txns.Count == 0)
            {
            }
            return (XPCollection<Txn>)txns;
        }

    }

但我收到以下错误:

    Error   1   Cannot implicitly convert type 'DevExpress.Xpo.XPCollection' to 'DevExpress.Xpo.XPCollection<FX.Module.BusinessObjects.fxdb.Txn>'
4

1 回答 1

0

下面的例子是我如何创建 XPCollections,我希望它可以帮助!

    private XPCollection<Txn> retrieveTransactions;

    public XPCollection<Txn> RetrieveTransactions
    {
        get
        {
            if (ObjectSpace is DevExpress.ExpressApp.Xpo.XPObjectSpace)
            {
                this.retrieveTransactions = new XPCollection<Txn>(Session);
            }

            return this.retrieveTransactions;
        }
    }
于 2014-08-12T13:20:27.077 回答