The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Finding Interfaces not in hierarchy

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Jonathan Crossland

Posts: 630
Nickname: jonathanc
Registered: Feb, 2004

Jonathan Crossland is a software architect for Lucid Ocean Ltd
Finding Interfaces not in hierarchy Posted: Mar 8, 2004 7:39 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Jonathan Crossland.
Original Post: Finding Interfaces not in hierarchy
Feed Title: Jonathan Crossland Weblog
Feed URL: http://www.jonathancrossland.com/syndication.axd
Feed Description: Design, Frameworks, Patterns and Idioms
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Jonathan Crossland
Latest Posts From Jonathan Crossland Weblog

Advertisement



The default for Type.GetInterfaces() return all Interfaces declared right through the hierarchy. Unfortunately, there is not option like the GetCustomAtributes() as where you can decide.
Instead to accomplish this you need to use FindInterfaces(), - something like this.

TypeFilter interfaceFilter = new TypeFilter(FindInterfacesFilter);

foreach (Type iinterface in _Type.FindInterfaces(interfaceFilter,null))
{
//Do something with the non-flattened hierarchical list
}


public bool FindInterfacesFilter(Type type,objectfilterObject)
{
foreach(Type iinterface in _Type.BaseType.GetInterfaces())
{
if (iinterface.Name == type.Name)
return false;
}
return true;
}




Read: Finding Interfaces not in hierarchy

Topic: XSLT stylesheet for RSS, SharePoint Database Explorer Previous Topic   Next Topic Topic: DevDays, Gartner ITxpo, etc...

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use