473,587 Members | 2,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

List objects which Implement a particular Interface

How would I traverse through a namespace and determine all the object
types that implement an interface.

For instance in the namespace "Microsoft.SqlS erver.Managemen t.Smo"
Namespace I want to determine all the Classes/Types which implement
the IScriptable Interface.

I am not looking for anyone to code this for me, as I am trying to
learn the language but any snippets or pointers would be greatly
appreciated.

Jul 26 '07 #1
1 1706
johnnyD <jo**********@g mail.comwrote:
How would I traverse through a namespace and determine all the object
types that implement an interface.

For instance in the namespace "Microsoft.SqlS erver.Managemen t.Smo"
Namespace I want to determine all the Classes/Types which implement
the IScriptable Interface.

I am not looking for anyone to code this for me, as I am trying to
learn the language but any snippets or pointers would be greatly
appreciated.
You can't easily traverse through a *namespace*, but you can go through
an *assembly*. You'll need to determine which assemblies you're
interested in.

Look at Assembly.GetTyp es, Type.GetNamespa ce, and Type.IsAssignab leFrom
for further steps.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jul 26 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
10921
by: Brett L. Moore | last post by:
Hi, I have had trouble determining whether the STL list.size() operation is O(1) or O(n). I know the list is a doubly-linked list, so if the size() operation begins at the head, then counts to the end - obviously its O(n). However, keeping track of inserts and deletes isn't that tough, so its conceivable (to me!) that size() could be...
8
2830
by: JustSomeGuy | last post by:
I need to write an new class derived from the list class. This class stores data in the list to the disk if an object that is added to the list is over 1K in size. What methods of the std stl list class must Ioverride in order for this to work?
3
2610
by: Eric | last post by:
I have a string representation of an object. I create an object of that type through reflection. I would like to create a List<> of those objects. I obviously can't do List<myObject.GetType()> or Type t = object.GetType(); List<t>;
1
10325
by: Brian Pelton | last post by:
I feel like I'm about to get in over my head, so before I go off the deep end I'm hoping someone can point me in the right direction. I started down the road of using a List<> of an Interface type. I wanted to be able to use List.Contains() to determine if the List already has a certain object based on the Name property - which is defined...
4
1461
by: Jim | last post by:
Dear Santa, While it's true that I haven't been perfect this year, it's definitely an improvement over previous years. All cats still have their own fur, no hidden cat fur in this year's Thanksgiving green bean casserole and not even one kid in the neighborhood has lost a toe this year! With these things in mind, I'd like to ask for...
25
2491
by: Jack | last post by:
Hi, Is there a general solution for the following problem: I have an array of instances of class B. Class B is publicly derived from class A. Then I have a class named Buffer that generally takes care of allocating and deallocating arrays. Class Buffer knows only that the objects contained in its internal array are derived from class A...
10
6564
by: AZRebelCowgirl73 | last post by:
This is what I have so far: My program! import java.util.*; import java.lang.*; import java.io.*; import ch06.lists.*; public class UIandDB {
5
1553
by: bz | last post by:
Hi, I create a class that retrieves a number of records from database. Internally, the class store the returned data in a datatable / datareader. I would like to bind a listbox to that class (to the records from this datatable), using data binding wizard and to be able to select bind to object How should I make this class to be able to...
55
3940
by: tonytech08 | last post by:
How valuable is it that class objects behave like built-in types? I appears that the whole "constructor doesn't return a value because they are called by the compiler" thing is to enable built-in-like behavior for objects of class type. That leads to the "necessity" for the exception machinery so that errors from constructors can be handled....
0
7923
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7852
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5719
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2364
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.