[Mono-list] Casting and Plugin Issue

Pablo Fischer pablo@pablo.com.mx
Sun, 27 Jun 2004 22:12:46 -0500


--=-AI+kHBemOAzwxHLzPAkx
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Yes sorry.

However, 't' is a BloggerPlugin that is inherited from an Interface
(IPlugin), how can I cast it and use it as an Object, like this:

> > > 	IPluging p =3D (IPlugin)t;
> > > 	object retVal =3D p.MGetPosts(3, user);

Can I cast an object that is inherited so the casted object will be the
'father' object?. Like this:

class Foo {
	Foo() {}
	public void Read() {
		//Something
 	}
}

class Bar : Foo {
	Bar() {}
}

Bar b =3D (Bar)f;

I tried and it fails:

Unhandled Exception: System.InvalidCastException: Cannot cast from
source type to destination type.
in <0x00080> PluginLoader:Main (string[])

Thanks!
Pablo

--=20
Pablo Fischer Sandoval (pablo [arroba/at] pablo.com.mx)
Fingerprint:  5973 0F10 543F 54AE 1E41  EC81 0840 A10A 74A4 E5C0
http://www.pablo.com.mx=20
http://www.debianmexico.org

--=-AI+kHBemOAzwxHLzPAkx
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada
	digitalmente

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBA34ytCEChCnSk5cARAkLRAKCSOXU6UoUZEvLEs4I2U5hWNYYLJwCgoAdQ
5v5Zx3RzA52sTh7R8bh71GU=
=t/sB
-----END PGP SIGNATURE-----

--=-AI+kHBemOAzwxHLzPAkx--