The question is very, very unclear. Please see my comment to the question.
But perhaps even preliminary notes will help you to solve the problem.
If this is ASP.NET and you are talking about CSS class, you can use JavaScript with jQuery with either the selector ".class" or using CSS methods. Please see:
http://api.jquery.com/class-selector/[
^],
http://api.jquery.com/category/selectors/[
^],
http://api.jquery.com/category/css/[
^],
http://api.jquery.com/hasClass/[
^].
If you need to learn jQuery, this is a good start:
http://docs.jquery.com/Tutorials:How_jQuery_Works[
^].
If you are talking about .NET classes: every object of all type (both reference and value types) can use the method
GetType
, because this is the method of
System.Object
which is a base class for all types:
http://msdn.microsoft.com/en-us/library/system.object.gettype.aspx[
^].
And you don't need to compare type names (actually, you should never do it), you should compare instances of
System.Type
themselves, using the "==" operator. To compare two references by type taking into account the inheritance, you need to use the
Is
operator:
http://msdn.microsoft.com/en-us/library/kb136x1y.aspx[
^].
You should really understand .NET type system very well, as this is the most important thing. But first thing you should understand about comparison of object by their type to provide different functionality:
this is the huge fundamental abuse of OOP, something that totally defeats OOP approach. Don't do it. Instead, learn how OOP works.
So, if you are not quite satisfied with this answer, you should explain properly what do you want to achieve. Start with explanation of your ultimate goals.
I'm quite sure the real solution will not be based on type comparison.
[EDIT]
Thank you for clarification, but they are still not 100% clear, and you should have explained it in first place. There is no pre-installed XML parser in .NET. If this is an HTML code well-formed as XML, you are lucky, can use any available XML parser. If this is not the case, you will need some HTML parser which can deal with that. You can use this one:
http://www.majestic12.co.uk/projects/html_parser.php[
^].
—SA