AJAX Client Side Programming
page 6 of 8
by Brian Mains
Feedback
Average Rating: 
Views (Total / Last 10 Days): 8214/ 189

Type Inspection

Because there are methods to register namespaces, classes, interfaces, and enumerations, there also exists the ability to perform reflection similar to the System.Reflection namespace in .NET.  I used the following code to create a string message, checking whether specific objects were of the specified type.  I'll explain each below:

Listing 17

var classInstance = new Nucleo.MyClass();
var msg = "isNamespace(Nucleo) = " + Type.isNamespace(Nucleo);
msg += "\nisClass(Nucleo.MyClass) = " + Type.isClass(Nucleo.MyClass);
msg += "\nisClass(classInstance) = " + Type.isClass(classInstance);
msg += "\nisInterface(Nucleo.MyInterface) = " + Type.isInterface(Nucleo.MyInterface);
msg += "\nisInterface(classInstance) = " + Type.isInterface(classInstance);
msg += "\nimplementsInterface(Nucleo.MyClass) = " +    
  Type.implementsInterface(Nucleo.MyClass);
alert(msg);

Each of these checks whether the object is of a specified type, by using the Type.is<Type> methods.  However, these methods do not work for class instances, but rather inspect the actual type name itself.  In my methods above, anywhere classInstance is used, a false value was returned.


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 3 and 1 and type the answer here:

User Comments

Title: Nice Article   
Name: ---
Date: 6/21/2008 5:40:01 AM
Comment:
really nice article, it is good for the beginners.
good job :)
Title: dragpanel extender in ajax controls   
Name: lalitha
Date: 6/12/2008 5:46:21 PM
Comment:
its not working as i had written as it was mentioned here in the tutorial plse give a brief coding about that control
Title: expect more   
Name: sivaram
Date: 5/2/2008 4:50:01 AM
Comment:
ok .i expected more.If possible plz explain with the examples
Title: nice but shud little brief   
Name: snehal
Date: 4/30/2008 3:20:58 PM
Comment:
nice article but give more details on ajax its merits... funnalities future implementation ....etc thnx
Title: thanks   
Name: suhas kudekar
Date: 4/23/2008 9:02:58 AM
Comment:
its very new concept 4 me. thanks
Title: very good   
Name: panakj lahjoti
Date: 4/21/2008 7:34:42 AM
Comment:
hai
i found this aticle very useful for the newbies
Title: Very helpful   
Name: Raviraj
Date: 4/20/2008 1:28:30 PM
Comment:
thanks it is very helpful to me






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2008 ASPAlliance.com  |  Page Processed at 10/13/2008 8:19:47 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search