jdubs edited this page Oct 21, 2016 · 1 revision

Table of Contents


Performs a traditional select or switch statement and returns the evaluated value.


SpecName (constant) The variable for assignment of the evaluated value.

Case (multiple) The object of comparison for the CaseArray parameter.

CaseArray (multiple) The key value pairs for comparison. Syntax is: {key=value}

ErrorMessage (multiple | optional) The error message to return when any error occurs.


This method programmatically mimics a select or switch statement. Essentially it replaces a long if statement. The method loops through the CaseArray attempting to find the matching key, and when found assigns the value to the SpecName variable. For example a Case of "P" and a CaseArray of {C=Catcher}{P=Pitcher}{LF=Outfield} will return "Pitcher".

Source Code

public static void Select(string SpecName, object Case, object CaseArray, object ErrorMessage)
		string result = (string)ErrorMessage;

		foreach (String m in SelectCaseMatches(CaseArray))
			string[] keypair = m.Split(new string[] { "=" }, StringSplitOptions.None);
			if (keypair[0] == (string)Case)
				result = keypair[1];
		Variable(SpecName).Value = result;
	catch (Exception ex)
		throw new Four51ActionsException(ex.Message, (string)ErrorMessage);

Referenced Methods

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.