473,805 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Enumerating built-in and custom Types available

I'm building an application generator and within it a user can create a new
property (for the class they are building). I'd like then to offer a list of
Types - built-in and custom - for this new property to be shown in a combo
box ie similar to Intellisense.

How do you enumerate the Types available? Are their mechanisms for filtering
the list to show only (say) primitive types or custom types or reference
types?

TIA

Crispin

Nov 21 '05 #1
4 1601
"CrispinH" <Cr******@discu ssions.microsof t.com> schrieb:
I'm building an application generator and within it a user can create a
new
property (for the class they are building). I'd like then to offer a list
of
Types - built-in and custom - for this new property to be shown in a combo
box ie similar to Intellisense.

How do you enumerate the Types available? Are their mechanisms for
filtering
the list to show only (say) primitive types or custom types or reference
types?


At runtime: 'System.Reflect ion', 'Assembly.GetTy pes', 'Type' class, ...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> escribió en el mensaje
news:un******** *****@TK2MSFTNG P10.phx.gbl...
At runtime: 'System.Reflect ion', 'Assembly.GetTy pes', 'Type' class, ...


Assembly.GetExp ortedTypes() will perform better, since you are interested
normally in public types...

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
Nov 21 '05 #3
Herfried

Thanks for that. Reflection was the clue I needed, but I'm not completely
where I want to be. Since I'm effectively trying to emulate VB.NET:

Dim objObject As ...

where the ... is the IntelliSense drop-down box. Thus far I've created test
code:

Dim objSystemObject Assembly As [Assembly] =
[Assembly].GetAssembly(Ge tType(System.Ob ject))
Dim objTypes() As Type = objSystemObject Assembly.GetTyp es

I chose the System.Object which returns 1480 items, many of which are not
relevant, so I filtered out those that weren't 'Public'.

However in a Visual Studio project, one puts in references eg:

System
System.Data
System.Drawing
System.Windows. Forms
System.XML

and this extends the Types available. I'd like to do a similar thing for my
users. I could pick an object at random in (say) System.Data and replace
System.Object in the above code, but this doesn't seem very elegant. Is
there a better way of achieving this?

Regards

Crispin

"Herfried K. Wagner [MVP]" wrote:
"CrispinH" <Cr******@discu ssions.microsof t.com> schrieb:
I'm building an application generator and within it a user can create a
new
property (for the class they are building). I'd like then to offer a list
of
Types - built-in and custom - for this new property to be shown in a combo
box ie similar to Intellisense.

How do you enumerate the Types available? Are their mechanisms for
filtering
the list to show only (say) primitive types or custom types or reference
types?


At runtime: 'System.Reflect ion', 'Assembly.GetTy pes', 'Type' class, ...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4
Carlos

I tried GetExportedType s instead of GetTypes and the count on the System
Object fell from 1480 to 905 which is a benefit. Filtering to include only
Public types brings it to 174 again (same for both).

I think I may to to implement some kind of Frequently Used Types system.

Thanks for your help.
Crispin

"Carlos J. Quintero [.NET MVP]" wrote:
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> escribió en el mensaje
news:un******** *****@TK2MSFTNG P10.phx.gbl...
At runtime: 'System.Reflect ion', 'Assembly.GetTy pes', 'Type' class, ...


Assembly.GetExp ortedTypes() will perform better, since you are interested
normally in public types...

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

Nov 21 '05 #5

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

Similar topics

1
2273
by: JimmyT | last post by:
I just configured and installed 2.3.4 and noticed there is no datetime module. I noticed there is a datetimemodule.c file that did not get built (ie no object file). Is there something I need to do to my system to make this module? Thanks, Jim
1
3121
by: Alex Elbert | last post by:
Hi I have built dynamic HTMLTable. Now I want to attach it directly to the Email Body - it is already built, so why not to use a ready table. However, I cannot find the way of getting plain HTML text out of dynamically built control. I tried to put my table between div and read div.innerHTML then - HTTP exception has been thrown. Any thoughts, ladies and gentelmen
0
2193
by: Andrew Crook | last post by:
does MYSQL have a quota built into it! I need it limit the size of each database AndiC
1
1894
by: Mark | last post by:
Is there a way to execute a statement that is built dynamically by a .NET application. For example I have a loop that is reading values from a database and I want to do something like the following. Dim stringa as string = "response.write somavalue" Execute(stringa) I realize this is not the best way to do this but it is
1
2111
by: William | last post by:
Looking for a pre built dotnet corporate or small business website template.
2
1687
by: Bishman | last post by:
Can anyone suggest a method of enumerating instances of MSDE 2000 without using DMO ? Using C++, MFC, and ADO. Thanks
1
3336
by: Glenn Leifheit | last post by:
Does anyone have any sample code on enumerating network shares with vb.net. I here you need to use wither an API or WMI, or are there other recomendations. Thanks Glenn
1
1325
by: Shelby | last post by:
Hi, I would like to modify the object's value while enumerating but I get this error Additional information: Collection was modified; enumeration operation may not execute. This is my code: Dim icom as MyOwnStructureObj Dim MyEnum As IDictionaryEnumerator = Myhash.GetEnumerator()
5
1351
by: Jay | last post by:
Hey There, I have this function that is called through EnumWindows: BOOL CALLBACK EnumOpenWindows(HWND hwnd, LPARAM lParam) { DWORD dwID; LPDWORD dwID2; LPDWORD currProcId; FILE* fp; struct _HwndProcStruct* locHPStruct;
48
4964
by: meyer | last post by:
Hi everyone, which compiler will Python 2.5 on Windows (Intel) be built with? I notice that Python 2.4 apparently has been built with the VS2003 toolkit compiler, and I read a post from Scott David Daniels where he said that probably the VS2003 toolkit will be used for Python 2.5 again. However, even before the release of Python 2.5, I cannot seem to find many retailers around here that still carry Visual Studio 2003, and some were a...
0
9716
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10604
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10361
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9179
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7644
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6874
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5676
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4316
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

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.