[300] Code Analysis
The code below yeilds the following when checking from an interface to a
concrete type:
public static T[] FlattenHierarchy(ICompositeTree item) where
T : BusinessObject
{
ICompositeTree root = item.GetTopLevel();
List result = new List]]>();
// The given expression is never of the provided type under 'root
is T' below.
if (!(root is T))
{
throw new Error("Bad cast flattening hierarchy.");
}
result.Add(root as T);
HarvestChildren(root, result);
return result.ToArray();
}
Please sign in to leave a comment.
May be your type is sealed and not implementing given interface?
--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Sean Kearon" <no@spam.org> wrote in message
news:adc66bd29db8c8cfc0d9ee53a0@news.jetbrains.com...
>
>
>
>
>
>
>
>