Receive an array from another process.

Important: if the type T is a value type (e.g., a primitive type or a struct of primitive types), then the values array must be pre-allocated with enough storage to store all of the values that will be received. If the message contains more data than can be received into the array, this method will throw a MessageTruncatedException or, in some cases, crash. Providing an array that is longer than the received message is allowable; to determine the actual amount of data received, retrieve the message length from the status result. Note that this restriction does not apply when T is a reference type that is serialized.

The Receive operation is a blocking operation, that will not complete until it has completely received a message.

Namespace:  MPI
Assembly:  MPI (in MPI.dll)
Version: (


public void Receive<T>(
	int source,
	int tag,
	ref T[] values,
	out CompletedStatus status
Visual Basic (Declaration)
Public Sub Receive(Of T) ( _
	source As Integer, _
	tag As Integer, _
	ByRef values As T(), _
	<OutAttribute> ByRef status As CompletedStatus _
Visual C++
generic<typename T>
void Receive(
	int source, 
	int tag, 
	array<T>^% values, 
	[OutAttribute] CompletedStatus^% status


Type: System..::.Int32
The process that sent (or that will send) the message. This must be a value in [0, Size-1), but it should not be equal to Rank. Alternatively, this might have the special value anySource, if the message can be received from any other process in this communicator.
Type: System..::.Int32
A message "tag" that identifies this particular kind of message. Only messages sent with this tag will be received by this call. The special value anyTag permits messages sent with any tag value to be received.
Type: array< T >[]()[] %
When Receive completes, this parameter will contain the values transmitted as part of the message. The values array must be large enough to contain all of the values that will be received.
Type: MPI..::.CompletedStatus %
Contains information about the received message.

Type Parameters

The type of the value that will be received. This type must be serializable.

See Also