Marshaling Data with Platform Invoke 之四 Marshaling Arrays of Types
2010-01-09 16:14
381 查看
Marshaling Arrays of Types
An array is a reference type in managed code that contains one or more elements of the same type. Although arrays are reference types, they are passed as In parameters to unmanaged functions. This behavior is inconsistent with way managed arrays are passed to managed objects, which is as In/Out parameters. For additional details, see Copying and Pinning.
The following table lists marshaling options for arrays and describes their usage. For the corresponding platform invoke sample, see Arrays.
![](http://i.msdn.microsoft.com/Global/Images/clear.gif)
See Also
Marshaling Strings
Marshaling Classes, Structures, and Unions
Miscellaneous Marshaling Samples
Copying and Pinning
An array is a reference type in managed code that contains one or more elements of the same type. Although arrays are reference types, they are passed as In parameters to unmanaged functions. This behavior is inconsistent with way managed arrays are passed to managed objects, which is as In/Out parameters. For additional details, see Copying and Pinning.
The following table lists marshaling options for arrays and describes their usage. For the corresponding platform invoke sample, see Arrays.
Array | Description |
---|---|
Of integers by value. | Passes an array of integers as an In parameter. |
Of integers by reference. | Passes an array of integers as an In/Out parameter. |
Of integers by value (two-dimensional). | Passes a matrix of integers as an In parameter. |
Of strings by value. | Passes an array of strings as an In parameter. |
Of structures with integers. | Passes an array of structures that contain integers as an In parameter. |
Of structures with strings. | Passes an array of structures that contain only integers as an In/Out parameter. Members of the array can be changed. |
![](http://i.msdn.microsoft.com/Global/Images/clear.gif)
See Also
Concepts
Platform Invoke Data TypesMarshaling Strings
Marshaling Classes, Structures, and Unions
Miscellaneous Marshaling Samples
Copying and Pinning
Other Resources
Marshaling Data with Platform Invoke相关文章推荐
- Marshaling Data with Platform Invoke 之一 Platform Invoke Data Types
- Marshaling Data with Platform Invoke 概览
- Marshaling Data with Platform Invoke 之二 Marshaling Strings (用时查阅)
- Marshaling Data with Platform Invoke 之三 Marshaling Classes, Structures, and Unions(用时查阅)
- Marshaling Data with Platform Invoke 之五 Miscellaneous Marshaling Samples(用时查阅)
- How to bind a GridView to a list of multiple types? NHibernate proxy causing problems with databinding [From stack overflow]
- DataPump Import Of Object Types Fails With Errors ORA-39083 ORA-2304 Or ORA-39117 ORA-39779 (Doc ID
- Platform Invoke and Marshaling Data: [1/3]
- Platform Invoke and Marshaling Data: [2/3] Calling the Windows CE API
- ValueError: Some of types cannot be determined by the first 100 rows, please try again with sampling
- Memory consumption of popular Java data types
- Working with Primitive Data Types
- [SoapUI] Loop a test with different sets of data
- [Ramda] Get a List of Unique Values From Nested Arrays with Ramda (flatMap --> Chain)
- Data Types and Expressions(Chapter 4 of Programming in Objective-C 2.0)
- (Swift报错提示)dataWithContentsOfURL
- 转贴:Backups with Bacula: A cross-platform system to archive your data
- How Google Backs Up The Internet Along With Exabytes Of Other Data
- Substring with Concatenation of All Words & Median of Two Sorted Arrays & Divide Two Integers
- two or more data types in declaration of 错误