Click here to Skip to main content
15,899,679 members
Home / Discussions / C#
   

C#

 
GeneralRe: WebResponse/WebRequest problem Pin
Keith Iveson11-Feb-03 22:33
Keith Iveson11-Feb-03 22:33 
GeneralRe: WebResponse/WebRequest problem Pin
John Mautari11-Feb-03 3:10
John Mautari11-Feb-03 3:10 
GeneralRe: WebResponse/WebRequest problem Pin
Keith Iveson11-Feb-03 22:40
Keith Iveson11-Feb-03 22:40 
GeneralRe: WebResponse/WebRequest problem Pin
John Mautari12-Feb-03 0:00
John Mautari12-Feb-03 0:00 
GeneralRe: WebResponse/WebRequest problem Pin
Keith Iveson12-Feb-03 0:06
Keith Iveson12-Feb-03 0:06 
GeneralRe: WebResponse/WebRequest problem Pin
John Mautari12-Feb-03 0:21
John Mautari12-Feb-03 0:21 
Generalunhandled exception Pin
Anonymous10-Feb-03 23:39
Anonymous10-Feb-03 23:39 
GeneralRe: unhandled exception Pin
Nick Parker11-Feb-03 3:12
protectorNick Parker11-Feb-03 3:12 
GeneralGenerate a UserControl without surface Pin
Nostra10-Feb-03 23:34
Nostra10-Feb-03 23:34 
GeneralRe: Generate a UserControl without surface Pin
Roger Alsing10-Feb-03 23:40
Roger Alsing10-Feb-03 23:40 
GeneralRe: Generate a UserControl without surface Pin
Nostra10-Feb-03 23:51
Nostra10-Feb-03 23:51 
GeneralSelecting a directory name Pin
chito10-Feb-03 22:03
chito10-Feb-03 22:03 
GeneralRe: Selecting a directory name Pin
John Mautari11-Feb-03 4:16
John Mautari11-Feb-03 4:16 
GeneralCOM+ !!! Pin
sss_dr10-Feb-03 20:49
sss_dr10-Feb-03 20:49 
GeneralDynamic Casting (Runtime) Pin
mgarwood10-Feb-03 15:09
mgarwood10-Feb-03 15:09 
GeneralRe: Dynamic Casting (Runtime) Pin
Christian Graus10-Feb-03 15:17
protectorChristian Graus10-Feb-03 15:17 
GeneralRe: Dynamic Casting (Runtime) Pin
David Stone10-Feb-03 17:55
sitebuilderDavid Stone10-Feb-03 17:55 
GeneralRe: Dynamic Casting (Runtime) Pin
Christian Graus10-Feb-03 18:05
protectorChristian Graus10-Feb-03 18:05 
GeneralRe: Dynamic Casting (Runtime) Pin
David Stone10-Feb-03 18:17
sitebuilderDavid Stone10-Feb-03 18:17 
GeneralRe: Dynamic Casting (Runtime) Pin
Christian Graus10-Feb-03 19:03
protectorChristian Graus10-Feb-03 19:03 
GeneralRe: Dynamic Casting (Runtime) Pin
David Stone10-Feb-03 19:10
sitebuilderDavid Stone10-Feb-03 19:10 
GeneralRe: Dynamic Casting (Runtime) Pin
Anonymous10-Feb-03 17:17
Anonymous10-Feb-03 17:17 
GeneralRe: Dynamic Casting (Runtime) Pin
mgarwood11-Feb-03 2:36
mgarwood11-Feb-03 2:36 
GeneralRe: Dynamic Casting (Runtime) Pin
David Stone11-Feb-03 3:26
sitebuilderDavid Stone11-Feb-03 3:26 
Actually, the IComparable interface isn't going to help you. The CompareTo() method returns an int. It's for sorting lists.

You should however, use the "is" keyword in order to find out if it "is" an instance of that class. Don't use GetType() typeof() or even CompareTo(). Let's say you had a function that looked like this:
public void Cast(object obj)
{
      if(obj is OneType)
      {
         OneType castedType = (OneType)obj;
         //Do other stuff appropriate to OneType in here
      {
      else if(obj is AnotherType)
      {
         AnotherType castedType = (AnotherType)obj;
         //Do other stuff appropriate to AnotherType in here
      {
      return;
}


If you really want dynamic casting, this is the way to do it. Using IComparable is not.

Hope that's clearer now. Smile | :)


Hey, what can I say? I'm a chick magnet...a babe conductor...a logarithm for the ladies.
-Strong Bad from HomeStarRunner.com


Essential Tips for Web Developers


GeneralRe: Dynamic Casting (Runtime) Pin
leppie11-Feb-03 7:30
leppie11-Feb-03 7:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.