开发者

What does "foo does not contain a definition for 'bar'..." mean?

开发者 https://www.devze.com 2023-01-23 17:15 出处:网络
I have add MIDI.dll into assembly property, I new to C# and following an example from MIDI.dot.net and got this error on device.Spec, what it mean by Midi.InputDevice does not contain a definition for

I have add MIDI.dll into assembly property, I new to C# and following an example from MIDI.dot.net and got this error on device.Spec, what it mean by Midi.InputDevice does not contain a definition for 'spec' a开发者_JAVA百科nd no extension method 'spec' accepting a first argument of type Midi.InputDevice could not be found (are you missing a using directive...)?

My using MIDI is exist on top and I use MonoDevelop IDE.

public override void Run()

        {

            // Print a table of the input device names, or "No input devices" if there are none.

            if (InputDevice.InstalledDevices.Count == 0)

            {

                Console.WriteLine("No input devices.");

            }

            else

            {

                Console.WriteLine("Input Devices:");

                foreach (InputDevice device in InputDevice.InstalledDevices)

                {

                    Console.WriteLine("  {0}", device.Spec);

                }

            }

            Console.WriteLine();



            // Print a table of the output device names, or "No output devices" if there are none.

            if (OutputDevice.InstalledDevices.Count == 0)

            {

                Console.WriteLine("No output devices.");

            }

            else

            {


The way you have your code written, I would expect Spec to be a Property of InputDevice.

According to the error message you're getting, that is not the case. There is no member named Spec on the type InputDevice.

Looking at the documentation here: InputDevice Class it definitely looks like that should be a valid Property. In your example, you have Spec upper cased but in the error message you provide, it is lower case. My guess is that it is lower case in your real code.

C# is case sensitive so that is probably why you are getting the error.


replace 'Spec' by 'Name' and it will work perfectly !

0

精彩评论

暂无评论...
验证码 换一张
取 消