19 using TraceLabSDK.Types.Generics.Collections;
21 namespace TraceLab.Components.Library.Helpers
23 [Component(Name =
"String Getter from String list",
24 Description =
"This simple helper component allows getting string from the specified collection of string at the specified index, and outputting it to Workspace.",
27 [IOSpec(IOSpecType.Input,
"listOfStrings", typeof(StringList))]
28 [IOSpec(IOSpecType.Input,
"index", typeof(
int))]
29 [IOSpec(IOSpecType.Output,
"selectedString", typeof(System.String))]
30 [Tag(
"Helper components")]
37 StringList listOfStrings = (StringList)Workspace.Load(
"listOfStrings");
38 if (listOfStrings == null)
40 throw new ComponentException(
"Received null listOfStrings");
42 if (listOfStrings.Count == 0)
44 throw new ComponentException(
"Received empty listOfStrings");
47 int index = (int)Workspace.Load(
"index");
51 throw new ComponentException(
"Received negative index");
53 if (index > listOfStrings.Count)
55 throw new ComponentException(
"Received index greater than amount of elements in the listOfStrings");
58 string outputString = listOfStrings[index];
60 Workspace.Store(
"selectedString", outputString);