473,404 Members | 2,213 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,404 software developers and data experts.

how to test if a given ctype is of a given template?

I would like to know if a type 'aType' is a Nullable<T>

With the debugger I have tried
typeof(Nullable<>).IsSubclassOf(typeof(Nullable<in t>)
typeof(Nullable<int>).IsSubclassOf(typeof(Nullable <>)
typeof(Nullable<>).IsAssignableFrom(typeof(Nullabl e<int>)
typeof(Nullable<int>).IsAssignableFrom(typeof(Null able<>)

They all 4 return false :S
Any tip?
Nov 23 '05 #1
1 1065
found it:
if (ft.IsGenericType && ft.GetGenericTypeDefinition() == typeof(Nullable<>))
.......

"Lloyd Dupont" <net.galador@ld> wrote in message
news:O0**************@TK2MSFTNGP09.phx.gbl...
I would like to know if a type 'aType' is a Nullable<T>

With the debugger I have tried
typeof(Nullable<>).IsSubclassOf(typeof(Nullable<in t>)
typeof(Nullable<int>).IsSubclassOf(typeof(Nullable <>)
typeof(Nullable<>).IsAssignableFrom(typeof(Nullabl e<int>)
typeof(Nullable<int>).IsAssignableFrom(typeof(Null able<>)

They all 4 return false :S
Any tip?

Nov 23 '05 #2

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

Similar topics

7
by: Robert Allan Schwartz | last post by:
Why do I get a syntax error below? I don't see why volatile works but unsigned does not work. I'm not looking for an answer of the form, "Because the Standard says so", or "Because the C++...
5
by: Stefan Krah | last post by:
Hello, I am currently writing code where it is convenient to convert char to int . The conversion function relies on a character set with contiguous alphabets. int set_mesg(Key *key, char...
4
by: festo | last post by:
Hi guys, I need to print a different footer depending on the template being printed. How do I test for the current template being processed in XSLT? Thanks, fes
1
by: aidy | last post by:
Hi I have some xml that is similar to this <testresults> <test id="test_1"> <description>demo test method 1</description> <teststatus>PASS</teststatus> </test> <test id="test_2">
176
by: nw | last post by:
Hi, I previously asked for suggestions on teaching testing in C++. Based on some of the replies I received I decided that best way to proceed would be to teach the students how they might write...
1
by: redgrL86 | last post by:
Hi, I am trying to figure out how to see if any of a given set of childnodes equals a given string. For example, in the XML and XSL code below, I want the text in the "xsl:when" statement to output...
4
by: David Sanders | last post by:
Hi, I have a class with an integer template parameter, taking values 1, 2 or 3, and a function 'calc' in that class which performs calculations. Some calculations need only be performed if the...
0
by: Malcolm Dew-Jones | last post by:
I have a test= that works but I would like to figure out how to move it into a match=. (Ok, that's unclear but pls keep reading.) Part of my XSLT file looks like this. <xsl:template...
19
by: Taras_96 | last post by:
Hi all, A poster at http://bytes.com/forum/thread60652.html implies that using strtoupper in transform doesn't work because ctype.h may define strtoupper as a macro: "The problem is that most...
2
by: Hvid Hat | last post by:
Hi I've been messing around with adding attributes to certain nodes. I've looked at FAQ at http://www.dpawson.co.uk/ without finding what I'm looking for. Is it possible to have a template...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...
0
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...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.