473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

determine if type is not .net type

Short of brute force , how to determine if a type is not a .net type ...
e.g. a custom type, such as an enum ...
Sep 23 '08 #1
5 1150
If you mean to separate types that the core libraries define
(System.dll, etc) from your own types, then there isn't anything built
in. The most generic approach would be to check the declaring assembly
against a list that you pre-define (or perhaps use the strong name
etc).

Marc
Sep 24 '08 #2
It depends precisely what you mean - it's not entirely clear. If you just
want to know whether the type is an enum or not, check GetType().IsEnum. If
you mean "is it something other than the primitive types int, bool, string
etc." you could check GetType().IsPrimitive or GetType().GetTypeCode(). If
you mean "is it something defined in the framework class library or not",
then you have to try something along the lines of what Marc says.

"John A Grandy" <johnagrandy-at-gmail-dot-comwrote in message
news:OT**************@TK2MSFTNGP03.phx.gbl...
Short of brute force , how to determine if a type is not a .net type ...
e.g. a custom type, such as an enum ...

Sep 24 '08 #3
That's what I was afraid of.

You'd think they'd build this in , it's such an obvious need.
"Marc Gravell" <ma**********@gmail.comwrote in message
news:c8**********************************@m45g2000 hsb.googlegroups.com...
If you mean to separate types that the core libraries define
(System.dll, etc) from your own types, then there isn't anything built
in. The most generic approach would be to check the declaring assembly
against a list that you pre-define (or perhaps use the strong name
etc).

Marc

Sep 29 '08 #4
On Mon, 29 Sep 2008 16:38:42 -0700, John A Grandy
<johnagrandy-at-gmail-dot-comwrote:
That's what I was afraid of.

You'd think they'd build this in , it's such an obvious need.
How so? To nearly the last one, the vast majority of applications should
never need this information.

In what way is the need so obvious? What makes it such an important thing
to be able to do that you're surprised it's not built-in?

Pete
Sep 30 '08 #5
Indeed - actually, I like that fundamentally there is no distinction,
and all types are (largely) equal citizens...

Marc
Sep 30 '08 #6

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

Similar topics

9
by: Lenard Lindstrom | last post by:
I was wondering if anyone has suggested having Python determine a method's kind from its first parameter. 'self' is a de facto reserved word; 'cls' is a good indicator of a class method ( __new__...
17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
3
by: Shahid Juma | last post by:
Hello All, This may be a trivial question, but I was wondering how can you determine if a value contains an Integer or Float. I know there is a function called IsNumeric, however you can't...
18
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code...
1
by: Dan | last post by:
All, I am working on an application that allows users to track various items for various clients. For example Client A may have an object Box where Client B has an object Canister. When a user...
14
by: J. Jones | last post by:
Suppose the following: class MyContainer : System.Collections.CollectionBase { //... } (where CollectionBase implements IList, ICollection) How do I determine if a type (such as...
16
by: Jm | last post by:
Hi All Is it possible to determine who is logged onto a machine from inside a service using code in vb.net ? I have found some code that seems to work under vb6, but doesnt under .NET ? Any help...
2
by: cody | last post by:
Hi! we are building an xml-export tool to export our business entities from out app. we use reflection to determine the data type of properties. e.g. we have a class Customer with a CustNo...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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,...
0
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...

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.