all groups > vj# > may 2005 >
You're in the

vj#

group:

System.Type.GetType method doesn't work, even though it should


System.Type.GetType method doesn't work, even though it should Avid J# Programmer
5/31/2005 8:10:02 PM
vj#:
Hey there guys, i'm giving Direct3D another shot with J#. But one problem is
stopping me from successfully running this very simple application.

When creating a VertexBuffer (collection of points in 3D space) i get an
error i shouldn't be getting. the following call:

System.Type typ = System.Type.GetType
("Microsoft.DirectX.Direct3D.CustomVertex.Transformed");

sets variable 'typ' to null. I have imported all the requires libraries and
they are added as references to the project. However, at runtime, it is as if
is does not exist. This is further proven while inside the IDE, because it
won't allow me to access
'Microsoft.DirectX.Direct3D.CustomVertex.Transformed.Format' even though i
know it exists. the error it gives me is 'Cannot resolve name
'Microsoft.DirectX.Direct3D.CustomVertex.Transformed.Format'
'. The tutorials i read on the net are in C#, and they use it just fine.

Is it because this is not a class, but a structure, extending
'System.ValueType'?

Or maybe this stuff isn't supported yet in J# for VS 2003?

This is confusing me: the difference between structures and classes in J#
--
Re: System.Type.GetType method doesn't work, even though it should gopikrishnam NO[at]SPAM gmail.com
6/20/2005 10:48:22 PM
This has nothing specific to J#. The problem is your assembly
(container of Microsoft.DirectX.Direct3D.C=ADustomVertex.Transformed) is
not being searched for the type.

You should first get the reference to the appropriate Assembly object
and then invoke GetType on that.

1) You can use System.Reflection.Assembly.Load or LoadFrom to load the
assembly if not already loaded.
2) You can use System.Reflection.GetExecutingAssembly() if the code
accessing the type is in the same assembly as the Type.

Gopi Krishna [MSFT]
Re: System.Type.GetType method doesn't work, even though it should Avid J# Programmer
6/21/2005 9:00:01 AM
However, the code won't even compile, because it can't find the classes that
i know exist, because they're used by C# users all the time. I have
referenced the right DLL files, and I can see
'Microsoft.DirectX.Direct3D.C­ustomVertex.Transformed' (which is a
System.ValueType) in the Object Browser. But i just can't access it inside my
code, the IDE thinks it does not exist.

device.set_VertexFormat (CustomVertex.Transformed.Format);
The code won't compile on this line, saying that CustomVertex is unresolved.
This is strange since i have imported
Microsoft.DirectX.Direct3D.CustomVertex.*; in my code as well as
Microsoft.DirectX.Direct3D.*


I have a feeling that J# does not support ValueTypes... But it would be nice
to know whether this is infact true or not.

How would i make this work? Code samples would greatly be appreciated, like
how i would use the 'System.Reflection.Assembly.Load' method to solve this
problem
--
http://www.hungryshadow.com


[quoted text, click to view]
AddThis Social Bookmark Button