Opalis Quick Integration Kit 3.0
Publishes a collection of values, all with the specified identifier.

Namespace:  Opalis.QuickIntegrationKit
Assembly:  Opalis.QuickIntegrationKit(in Opalis.QuickIntegrationKit.dll) Version: 3.0.0.0 (3.1.0.1)

Syntax

C#
int 
PublishRange(
	
string 
id,
	
IEnumerable 
values
)
Visual Basic (Declaration)
Function 
PublishRange ( _
	
id 
As 
String, _
	
values 
As 
IEnumerable _
) 
As 
Integer
Visual C++
int 
PublishRange(
	
String^ 
id, 
	
IEnumerable ^ 
values
)

Parameters

id
Type: System . . :: . String
The name of the data that is being published.
values
Type: System.Collections . . :: . IEnumerable
The set of values to be published.

Return Value

The number of values that were actually published

Examples

CopyC#
[OpalisObject(
"Random Numbers")]
public 
class RandomNumbers
{

public 
void Design(IOpalisDesigner
designer)
	{
		designer.AddInput(
"How Many");
		designer.AddInput(
"Seed");
		designer.AddOutput(
"Values");
}


public 
void Execute(IOpalisRequest
request, IOpalisResponse response)
	{
	
int howMany =
request.Inputs[
"How Many"].AsInt32();
	
int seed = request.Inputs[
"Seed"].AsInt32();
		response.PublishRange(
"Values",
GetRandomNumbers(howMany, seed)); 
}


private 
static IEnumerable
GetRandomNumbers(
int howMany, 
int seed)
	{
		Random random = 
new Random(seed);
	
for (
int i = 
0; i < howMany; i++)
		{
			yield 
return random.Next();
	}
}
}

See Also