Ask a Question related to ASP.NET General, Design and Development.
-
William F. Robertson, Jr. #1
C# interfaces
This is probably a more C# language question, but how can I tell if an
object implements a certain interface?
bill
William F. Robertson, Jr. Guest
-
Custom interfaces
Hi. My web service class implements a custom interface. When I see the service description, my custom interface is not there. In my client, I... -
Interfaces and webservices
VB.NET Hi Im writing a windows form that talks to its business layer via web services. I want to define an interface that both client and web... -
Interfaces And Web Services
Hi, Im having a little trouble with the fiollowing in a web service Public Interface IBookAttribute Property Description() As String End... -
[PHP-DEV] problem with interfaces
Hi all, Is this supposed to work? interface test { function my_function ($mandatory_parameter); } class test_class implements test {... -
IPSec Interfaces
This is my second posting as I took all the advice on the first and it helped a bit but I'm still getting errors on my Event Log. My IPSec can't... -
Chris J. Breisch #2
Re: C# interfaces
On Wed, 2 Jul 2003 10:49:48 -0500, William F. Robertson, Jr.
<wfrobertson@kpmg.com> wrote:
Since you mentioned C#, I'll give my answer in C#.
if (o is IMyInterface) {
// object o implements IMyInterface
}
else {
// object o doesn't implement IMyInterface
}
-chris
> This is probably a more C# language question, but how can I tell if an
> object implements a certain interface?
>
> bill
>
>
>
--
Chris J. Breisch, MCSD.NET, MCDBA
Chris J. Breisch Guest
-
[Gauthier] #3
Re: C# interfaces
Hello,
there is also the 'as' keyword:
IMyInterface i = o as IMyInterface
if(i != null)
{
// i implements IMyInterface
}
else
{
// i does not implements IMyInterface
}
it allow you to bypass the cast that you need to put when using 'is' keyword
Now my question: Is there any fundamental diference between these 2 ways to
do slighty the same thing?
Gauthier
"Chris J. Breisch" <cjbreisch@yahoo.com> wrote in message
news:oprroyihlb6mljj1@news.microsoft.com...> On Wed, 2 Jul 2003 10:49:48 -0500, William F. Robertson, Jr.
> <wfrobertson@kpmg.com> wrote:
>
>
> Since you mentioned C#, I'll give my answer in C#.
>
>
> if (o is IMyInterface) {
> // object o implements IMyInterface
> }
> else {
> // object o doesn't implement IMyInterface
> }
>
> -chris
>>> > This is probably a more C# language question, but how can I tell if an
> > object implements a certain interface?
> >
> > bill
> >
> >
> >
>
>
> --
> Chris J. Breisch, MCSD.NET, MCDBA
[Gauthier] Guest



Reply With Quote

