It's already great that you use tags to categorize your products. This can be very powerful or very weak depending on the tags you use.
First of all: make sure you use meaningful tag names.
[Bad: C#1 , C#1.0 , Ruby1 , Ruby-1 , etc.]
[Good: C#1 , C#2 , C#3 , Ruby1 , Ruby2 , etc.]
Now you can create your GetRelatedItmesList method, which, of course, is Generic , and perform the checks.
For example, something like this:
List<T> GetRelatedItemsList<T> (T item) where T : IOurMediaItem
In any case, you can also do switch() in the item.TagCount property / method.
source share