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

test for value type

Hi, Is there a way to tell if an abritrary type is a value or reference
type? In my application i need to add both kinds to a
System.Collections.Queue, for reference types i need to make deep copies.

Thanks,
Mark
Nov 15 '05 #1
3 6397
Mark,
All value types inherit from System.ValueType.

Try something like:
if (x is ValueType)
{
}

Hope this helps
Jay

"Mark Oliver" <ma*********@comcast.net> wrote in message
news:dD*******************@rwcrnsc52.ops.asp.att.n et...
Hi, Is there a way to tell if an abritrary type is a value or reference
type? In my application i need to add both kinds to a
System.Collections.Queue, for reference types i need to make deep copies.

Thanks,
Mark

Nov 15 '05 #2
Mark,
All value types inherit from System.ValueType.

Try something like:
if (x is ValueType)
{
}

Hope this helps
Jay

"Mark Oliver" <ma*********@comcast.net> wrote in message
news:dD*******************@rwcrnsc52.ops.asp.att.n et...
Hi, Is there a way to tell if an abritrary type is a value or reference
type? In my application i need to add both kinds to a
System.Collections.Queue, for reference types i need to make deep copies.

Thanks,
Mark

Nov 15 '05 #3
Hi Jay
Thanks very much, that gets it done.
Mark

"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Mark,
All value types inherit from System.ValueType.

Try something like:
if (x is ValueType)
{
}

Hope this helps
Jay

"Mark Oliver" <ma*********@comcast.net> wrote in message
news:dD*******************@rwcrnsc52.ops.asp.att.n et...
Hi, Is there a way to tell if an abritrary type is a value or reference
type? In my application i need to add both kinds to a
System.Collections.Queue, for reference types i need to make deep copies.
Thanks,
Mark


Nov 15 '05 #4

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

Similar topics

5
by: kmunderwood | last post by:
I am trying to combine "if match=" and "when test" I am a newbie, and have made both work separately, but I can not seem to combine them. This is my xml("index.xml")page(I can not change this,...
6
by: WindAndWaves | last post by:
Hi Folks I have inhereted a script that I understand reasonably well, I just do not understand !/^\d+$/.test(el.value) what the hell does that mean? Below is the script (there are really...
9
by: Steve Sargent | last post by:
Hi: I'm trying to debug the following code, and it keeps looping on the if statement: public static bool operator == (OnlineMemberNode first, OnlineMemberNode second) { if(first == null) {
5
by: Little | last post by:
I have this program and I need to work on the test portion, which tests if a Val is in the list. It returns false no matter what could you look at the part and see what might need to be done to fix...
3
by: jab3 | last post by:
Hello. I"m new to this group, and to JavaScript in general, so please forgive me if I breach local etiquette. I'm trying to implement some client-side 'dynamic' validation on a form. I'm having...
1
by: mbarnhizer | last post by:
Hello All, Trying to figure out how to validate a series of questions on an online test. I am thinking that VB or Javascript is the best route, but your input may make a difference. The site i...
2
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer...
4
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer...
10
by: Faisal Shah | last post by:
HI, Well, Here is the code of my new project .. Actually it's just s scrap or it.. I have made 2 files. the 1st file is test.php with of course creating a new file called testdb.txt. And...
2
by: hcaptech | last post by:
This is my Test.can you help me ? 1.Which of the following statement about C# varialble is incorrect ? A.A variable is a computer memory location identified by a unique name B.A variable's name...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.