0

私は、IBar実際には .net リモート処理透過プロキシ (RuntimeServices.IsTransparentProxy true) であるオブジェクト バーを受け取り、一連のIFoo型に対してこれを行うコードを見ています。

var fooValue = bar as IFoo; // BTW, IFoo is always derived from IBar! But not sure if it matters
if (fooValue != null)
   // and then eventually call some method on IFoo, we can imagine.

残念ながら、この型キャストはうまく機能していません。多くの CPU 時間を使用しているようです。これを行うためのより良い方法は何でしょうか? (残念ながら、それは透過的なプロキシであるため、実行できませんbar.GetType().GetInterfaces()...)

4

0 に答える 0