These examples illustrate the MarkOperationResult enumeration.
The first example illustrates the ErrorModeReserved value.
public void ExerciseMarkOperationResult()
{
// Declare enumeration to hold return value of
// call to MarkProfile.
MarkOperationResult result;
// Force MarkProfile to return a value that says an error
// occurred. In this case, MarkProfile should be passed
// a value greater than or equal to zero. Passing in
// a -1 should return a value that indicates that the
// passed in parameter was less than or equal to zero.
result = DataCollection.MarkProfile(-1);
if (result == MarkOperationResult.ErrorMarkerReserved)
{
Console.WriteLine("Valid Result: Input was -1 and MarkProfile returned {0}", result);
}
else
{
Console.WriteLine("Invalid Result: MarkProfile Returned code {0} with input {1}", result.ToString(), -1);
}
}
The second example illustrates the MarkOperationResult enumeration to hold the return value of a call to the CommentMarkProfile method.
public void ExerciseMarkOperationResult()
{
// Declare and initialize variables to pass to
// CommentMarkProfile. The values of these
// parameters are assigned based on the needs
// of the code; and for the sake of simplicity
// in this example, the variables are assigned
// arbitrary values.
int markId = 02;
string markText = "Exercising CommentMarkProfile...";
// Declare enumeration to hold return value of
// call to CommentMarkProfile.
MarkOperationResult markResult;
markResult = DataCollection.CommentMarkProfile(
markId,
markText);
Console.WriteLine("CommentMarkProfile returned {0}",
markResult);
}