473,385 Members | 1,387 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,385 software developers and data experts.

Types problem?

I create an object "A" dynamiclly using Emit, I tryed to cast ti "A" the obtained object and it throw a cast exception
I saw that as strings the types are the same but the follow condition return false
if (typeof(A) == objectObtainedDynamicly.GetType
return true
return false

Nov 15 '05 #1
2 950
ya1000 <an*******@discussions.microsoft.com> wrote:
I create an object "A" dynamiclly using Emit, I tryed to cast ti "A"
the obtained object and it throw a cast exception.
I saw that as strings the types are the same but the follow condition
return false:
if (typeof(A) == objectObtainedDynamicly.GetType)
return true;
return false;


As I said this morning, please produce a short but complete example.
The above is somewhat bizarre, as typeof(A) can only work when the type
A exists at compile time - so why are you generating another type with
the same name?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2
I gave up trying to compare this way, I convert types to their string names;

if (typeof(A).ToString() == objectObtainedDynamically.GetType().ToString())
{}
-ilpostino

"ya1000" <an*******@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
I create an object "A" dynamiclly using Emit, I tryed to cast ti "A" the obtained object and it throw a cast exception. I saw that as strings the types are the same but the follow condition return false: if (typeof(A) == objectObtainedDynamicly.GetType)
return true;
return false;

Nov 15 '05 #3

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

Similar topics

0
by: Pete Shinners | last post by:
I've been spending the last few night upgrading some 'classic' type objects to the more modern 'newstyle' types. Unless I am not finding some important page, this entire process is almost entirely...
5
by: Javier Campos | last post by:
WARNING: This is an HTML post, for the sake of readability, if your client can see HTML posts, do it, it doesn't contain any script or virus :-) I can reformat a non-HTML post if you want me to (and...
8
by: Edward Diener | last post by:
I have a __value class which uses some legacy C++ code. So I wrapped the legacy C++ code in another __nogc class and have a pointer to that class as a member of my __value class. When the __value...
6
by: Moshe Kravchik | last post by:
Hi all! I have 2 web services, one writtenin C++ (ATL) and another one in C#. Is there a way to define data stuctures in a single place both services could use? The structures are the same, but if...
1
by: louis_la_brocante | last post by:
Dear all, I am having trouble generating a client proxy for a webservice whose methods return a "complex" type. The type is complex in that it is a class whose members are a mix of primitive...
12
by: Edward Diener | last post by:
Given value class X { public: // Not allowed: X():i(100000),s(10000) { } // Allowed void InitializeDefaults() { i = 100000; s = 10000; } private: int i;
58
by: jacob navia | last post by:
Hi people I have been working again in my tutorial, and I have finished the "types" chapter. If you feel like "jacob bashing" this is the occasion! I am asking for criticisms, or for things I may...
130
by: euler70 | last post by:
char and unsigned char have specific purposes: char is useful for representing characters of the basic execution character set and unsigned char is useful for representing the values of individual...
16
by: Dom Fulton | last post by:
Has anyone got a mechanism for finding the number of bits in floats, doubles, and long doubles? I need this to communicate with some hardware. I guess I could try to deduce this from float.h,...
13
by: John W. | last post by:
Hi there, Does anyone know if there's a (simple) way to detect whether an arbitrary "System.Type" originates from the .NET framework opposed to a user-defined assembly. Thanks.
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: 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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.