它已经伟大的,你正在使用tags
分类您的项目。 这可能是非常强大或非常弱,取决于您使用的标签。
首先:确保您使用的是有意义的标签名称。
[坏的:C#1
,C#1.0
,Ruby1
,Ruby-1
等]
[好的:C#1
,C#2
,C#3
,Ruby1
,Ruby2
等]
现在你可以建立GetRelatedItmesList
方法当然是Generic
并做检查。
例如是这样的:
List<T> GetRelatedItemsList<T> (T item) where T : IOurMediaItem // I used an interface here because I like them :P - it can also be a class.
{
if (item.TagCount == 1)
{
// Get related items with the same tag and based on some keywords in title
}
else
{
// First: Get all items with exactly the tags
// Second Get all items with relating title and append it to the list
}
}
无论哪种方式,您还可以在item.TagCount
属性/方法做了switch()
。
使用谷歌应用? – 2010-03-06 07:51:58