Related articles |
---|
[8 earlier articles] |
Re: How to implement dynamic typing? torbenm@diku.dk (2010-04-07) |
Re: How to implement dynamic typing? ctalk@ctalklang.org (Ctalk Project) (2010-04-07) |
Re: How to implement dynamic typing? gneuner2@comcast.net (George Neuner) (2010-04-07) |
Re: How to implement dynamic typing? cr88192@hotmail.com (BGB / cr88192) (2010-04-10) |
Re: How to implement dynamic typing? bartc@freeuk.com (bartc) (2010-04-11) |
Re: How to implement dynamic typing? harold.aptroot@gmail.com (Harold Aptroot) (2010-04-11) |
Re: How to implement dynamic typing? cr88192@hotmail.com (BGB / cr88192) (2010-04-11) |
Re: How to implement dynamic typing? cr88192@hotmail.com (BGB / cr88192) (2010-04-12) |
Re: How to implement dynamic typing? gneuner2@comcast.net (George Neuner) (2010-04-13) |
Re: How to implement dynamic typing? bartc@freeuk.com (bartc) (2010-04-14) |
Re: How to implement dynamic typing? dot@dotat.at (Tony Finch) (2010-04-14) |
Re: How to implement dynamic typing? cr88192@hotmail.com (BGB / cr88192) (2010-04-16) |
Re: How to implement dynamic typing? gneuner2@comcast.net (George Neuner) (2010-04-18) |
[10 later articles] |
From: | "BGB / cr88192" <cr88192@hotmail.com> |
Newsgroups: | comp.compilers |
Date: | Sun, 11 Apr 2010 23:51:31 -0700 |
Organization: | albasani.net |
References: | 10-04-009 10-04-028 10-04-032 |
Keywords: | types |
Posted-Date: | 12 Apr 2010 11:59:19 EDT |
"Harold Aptroot" <harold.aptroot@gmail.com> wrote in message
> "BGB / cr88192" <cr88192@hotmail.com> wrote in message
>> C++: if(dynamic_cast<Foo>(obj)) ...
>> Java: if(obj instanceof Foo) ...
>> C#: if(typeof(Foo).IsInstanceOf(obj)) ...
>
> How about: if (obj is Foo) for C#?
I didn't know about this when I wrote this message...
but, yes, this is a better notation...
I am not exactly well experienced in C#, FWIW.
actually, at first I didn't even know this, so I was left using casts and
catching the exception, but figured there had to be a better way than this
(I didn't believe MS would botch up this bad). after a lot of fiddling, I
figured out the "typeof" notation, and it worked.
"is" seems better though.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.