Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9001177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:24:06+00:00 2026-06-16T00:24:06+00:00

See the following simple casting example: int i = 1000; object o = (object)i;

  • 0

See the following simple casting example:

int i = 1000;
object o = (object)i; // cast

i.CompareTo(1000);
o.CompareTo(1000); // error

I understand why the last line generates an error. Unlike ints, objects don’t implement IComparable and therefore don’t expose the CompareTo method. The following also generates an error:

string s = (string)i; // cast error

Since there’s no inheritance between ints and strings, casting will not work here. Now, take a look at this:

AudioRender a = new AudioRender();
IBaseFilter b = (IBaseFilter)a; // cast

a.Run(1000); // error
b.Run(1000);

(These classes come from the DirectShowNet library.)

I don’t understand this. The cast does not generate an error and throws no exceptions at runtime, so I assume that AudioRender implements IBaseFilter. However, AudioRender does not expose any of IBaseFilter’s methods, indicating that my assumption above is wrong…

If a implements b, why doesn’t a expose the methods of b?
Else, if a does not implement b, why can a be casted to b?
Also, can I reproduce this behaviour without the use of DirectShowNet?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:24:06+00:00Added an answer on June 16, 2026 at 12:24 am

    It is likely that AudioRender implements Conversion Operator.

    However, having looked at code it seems that both AudioRender and IBaseFilter are Com Imports:

    [ComImport, Guid("e30629d1-27e5-11ce-875d-00608cb78066")]
    public class AudioRender { }
    
    
    [ComImport, ("56a86895-0ad4-11ce-b03a-0020af0ba770"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IBaseFilter { .. }
    

    As you can see AudioRender import class does not implement IBaseFilter, so you will not see it in intellisense, but it is likely that underlying COM object implements it, hence why you can cast.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please see following methods. public static ProductsCollection GetDummyData(int? customerId, int? supplierId) { try {
Given the following simple code, how can I pass a state object along so
I have the following simple code: http://jsfiddle.net/QUBCq/ You can see that I have 3
I have the following simple code (see below) I copied from a book. But
I have a set of simple shapes (see following figure), and I want to
Consider the following simple example: private Action _action; public Form1() { InitializeComponent(); } private
I see the following simple XML. <?xml version=1.0?> <customers> <customer ID=C001> <name>Acme Inc.</name> <phone>12345</phone>
I have written following simple code to see the behavior of rendering. In this
Take the following simple example: interface IVehicle { } class Car : IVehicle {
I have the following simple code : int speed1 = (int)(6.2f * 10); float

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.