我有另一个简单的(我认为)这是困扰着我。我已经在我的一个控件中编写了一个方法,该方法在CMS中给出文件的最新版本(即文件的文件夹位置)。我发现它非常有用,因为我认为我将它放在我的CMSToolbox类中,但是当我这样做时,我不能再使用CMS提供的FileManager类的Where()
方法(它将返回一个列表)。C#初学者:我的IList.Where()方法在哪里去了?
这是我班的一个简单的例子:
using System;
using System.Collections.Generic;
using CMS.CMS;
using CMS.Core;
using CMS.Web;
namespace CoA.CMS {
public class ToolBox
{
public CMS.CMS.File getLatestFileVersionByFilename(string filename, int GroupID)
{
IList<CMS.CMS.File> fileWithName = FileManager.GetGroupAll(false, GroupID).Where(file => currentFileVersionIsNamed(file, filename)).ToList<CMS.CMS.File>();
return getLatestFileFromListOfFiles(fileWithName);
}
protected bool currentFileVersionIsNamed(CMS.CMS.File file, string name)
{
}
protected CMS.CMS.File getLatestFileFromListOfFiles(CMS.CMS.File file)
{
}
}
}
当我做同样的事情在控制我有机会获得Where()
(真由延伸Control
的CMS提供的一类)的情况下方法,但在我的ToolBox类中,我没有。是什么赋予了?我认为IList
总是允许从任何地方访问相同的方法。
我是错了,哈哈:)
编辑:Filemanager.GetGroupAll()
返回CMSList
延伸IList
你,先生,是绝对的bl ** dy传奇!做得好! :) –