[newbie] Converting structures

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

in my project, I make use of two namespaces and each of it uses the same structure (so that the same structure is defined two times). Now, when I try to call a function of the second namespace out of the first one, VB.NET throws a compiler error, saying that I can't convert from Proj1.namespace1.mystruct to Proj1.namespace2.mystruct - although it's just the same structure !!

Can anyone help me

Gordon
 
Its doesn't matter that the structures are the same (or even in two
different namespaces), type safety prevents this kind of conversion. If you
could readily convert (cast) between any two types with the same structure,
you would have a easy way to bypass application logic that contrained values
held in the type.

If you need to use the same structure in two places, one simple way would be
to put it in its own assemble, and use it whereever its needed.

Nick.

Gordon Knote said:
Hi,

in my project, I make use of two namespaces and each of it uses the same
structure (so that the same structure is defined two times). Now, when I try
to call a function of the second namespace out of the first one, VB.NET
throws a compiler error, saying that I can't convert from
Proj1.namespace1.mystruct to Proj1.namespace2.mystruct - although it's just
the same structure !!!
 
Back
Top