question

paulcdempsey avatar image
0 Votes"
paulcdempsey asked JunjieZhu-MSFT answered

Why does MidiInPort:FromIdAsync return a (wrapped) MidiInport, and MidiOutPort return an *I*MidiOutPort?

public static IAsyncOperation<MidiInPort> FromIdAsync(string deviceId);
public static IAsyncOperation<**I**MidiOutPort> FromIdAsync(string deviceId);

Why does MidiInPort:FromIdAsync return a (wrapped) MidiInport, and MidiOutPort return an *I*MidiOutPort?

Is this simply a naming inconsistency, or is there something more meaningful to the distinction?


windows-uwpwindows-api
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @paulcdempsey ,
Welcome to Microsoft Q&A!

I checked the relevant documents, and it is true that the two APIs are different as you said, but there is no relevant explanation in the official documents.
Do you encounter any problems during the development process? Or need an explanation for why it's designed this way?

Thank you,
Junjie

0 Votes 0 ·

I'm not aware of a problem so far, but since I'm just starting with this area of the Windoes API, I'd like to know why it's this way. It's possible it's just sloppiness on Microsoft's part, but can't fix it for compatability reasons, or maybe there's a subtle gotcha down the road that it would be good to know about.

0 Votes 0 ·

This return value does not affect the use of functions, but I will ask the team why it is designed this way.

0 Votes 0 ·

1 Answer

JunjieZhu-MSFT avatar image
0 Votes"
JunjieZhu-MSFT answered

Hello @paulcdempsey ,
Welcome to Microsoft Q&A!

I have received feedback from the team. This is by design, it does not affect the use.
So you can cast the interface IMidiOutPort to a class MidiOutport, since we have access to this other class as well.

Thank you.


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.