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

Type

I want to use a static method of a class using only the text name of the
class and the text name of the method.

The Assembly Name for this Static class is "DALLibrary"
The Namespace name for the Static Class is "GL.DAL"
The Class name of the Static class is "GL_ACCOUNT_TBL_DAL"

I tried to create a "Type" object with the following set of instructions...

string myclass = "DALLibrary.GL.DAL.GL_ACCOUNT_TBL_DAL";
Type myType = Type.GetType(myclass);

This returns "null". What is wrong with how I am constructing my "Type"?
Thanks in advance for your assistance!!
Jul 16 '07 #1
4 1183
OldButStillLearning wrote:
I want to use a static method of a class using only the text name of the
class and the text name of the method.

The Assembly Name for this Static class is "DALLibrary"
The Namespace name for the Static Class is "GL.DAL"
The Class name of the Static class is "GL_ACCOUNT_TBL_DAL"

I tried to create a "Type" object with the following set of instructions...

string myclass = "DALLibrary.GL.DAL.GL_ACCOUNT_TBL_DAL";
Type myType = Type.GetType(myclass);

This returns "null". What is wrong with how I am constructing my "Type"?
As it appears that GL_ACCOUNT_TBL_DAL is in a different assembly, you
need to pass the assembly qualified name to your GetType call. That
format would like similar to:

TopNamespace.SubNameSpace.ContainingClass+NestedCl ass, MyAssembly,
Version=1.3.0.0, Culture=neutral, PublicKeyToken=b17a5c561934e089
--
Tom Porterfield
Jul 16 '07 #2
As my example shows, I am passing the assembly name...
Jul 16 '07 #3
OldButStillLearning wrote:
As my example shows, I am passing the assembly name...
And as my reply shows in comparison, you are passing it incorrectly.
Yours should look something like:

GL.DAL.GL_ACCOUNT_TBL_DAL, DALLibrary, Version=<assembly version>,
Culture=neutral, PublicKeyToken=<assembly public key>

Replace <assembly versionwith the version of DALLibrary. Replace the
neutral culture with the assembly culture if it has one. Replace
<assembly public keywith the public key token for the assembly, or
null if it doesn't have one. The basic format is:

Namespace.Class, Assembly, Version, Culture, PublicKeyToken
--
Tom Porterfield
Jul 16 '07 #4

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

Similar topics

21
by: Batista, Facundo | last post by:
Here I send it. Suggestions and all kinds of recomendations are more than welcomed. If it all goes ok, it'll be a PEP when I finish writing/modifying the code. Thank you. .. Facundo
6
by: S.Tobias | last post by:
I'm trying to understand how structure type completion works. # A structure or union type of unknown # content (as described in 6.7.2.3) is an incomplete type. It # is ...
0
by: Chris Fink | last post by:
When I am consuming a webservice, an object has an undefined value (inq3Type.Call3Data). I do not completely understand why this is happening and apologize for the vague question. My assumption...
1
by: Rob Griffiths | last post by:
Can anyone explain to me the difference between an element type and a component type? In the java literature, arrays are said to have component types, whereas collections from the Collections...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
3
by: john | last post by:
Hi to All To demonstrate: public class MyBaseGenericClass<T> { } public class MyGenericClass1<T: MyBaseGenericClass<T> {
7
by: Sky | last post by:
I have been looking for a more powerful version of GetType(string) that will find the Type no matter what, and will work even if only supplied "{TypeName}", not the full "{TypeName},{AssemblyName}"...
9
by: weirdwoolly | last post by:
Hopefully someone will be able to help. I have written a stored procedure in C++ called from a Java test harness to validate the graphic data types in C++ and their use. I have declared the...
5
by: JH | last post by:
Hi I found that a type/class are both a subclass and a instance of base type "object". It conflicts to my understanding that: 1.) a type/class object is created from class statement 2.) a...
3
by: amanjsingh | last post by:
Hi, I am trying to implement Java Web Service using Apache Axis2 and Eclipse as a tool. I have created the basic code and deployed the service using various eclipse plugin but when I try to invoke...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.