次の方法で共有


About .NET Framework Data Types

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

This section contains the information you need to translate the script-oriented Object Model Reference into Microsoft .NET Framework base data types. The Windows Media Player script reference has almost all the information you need to use the Windows Media Player control in a .NET Framework-based program, and in most cases, the syntax will be similar to that of other scripting languages such as Microsoft JScript.

The Windows Media Player reference provides the JScript data type and, if necessary, the C++ conversion. For example, a Number might be returned by a method. JScript treats all numbers in the same way, but other languages distinguish between different types of numbers (integer, floating point, and so on). The reference gives the C++ conversion for number data types because numbers can be processed differently by C++. For example, C++ uses the int data type for integer arithmetic and float for floating point.

The .NET Framework uses a slightly different system of base data types. The following table shows the differences in the common data types you are likely to use. For more information on .NET Framework base data types and the conversion to other data type systems, see the .NET Framework Developer's Guide discussion of System Namespace base data types.

This table gives the .NET Framework class name and the C# data type. Data types for other languages are defined for each language in their respective language references.

Script data type C++ data type .NET Framework class (C# data type )
Number int Int32 (int)
Number long Int32 (int)
Number double Double (double)
Number float Single (float)
String BSTR String (string)
Boolean VARIANT_BOOL Boolean (bool)
Object Object Object (object)

 

If you are using Visual Studio, you can use the Microsoft IntelliSense technology to determine what data type is expected for a specific function.

Embedding the Windows Media Player Control in a .NET Framework Solution

Object Model Reference for Scripting