Example #1
0
 /// <summary>
 /// Gets a variable given its name and type.
 /// </summary>
 /// <param name="name">The name of the variable</param>
 /// <param name="type">The type of the variable</param>
 /// <returns>The variable or null if it wasn't found.</returns>
 public CVar Get(string name, CVar.VarType type)
 {
     return(All.FirstOrDefault(v => v.Name == name && v.Type == type));
 }
Example #2
0
 /// <summary>
 /// Helper method that checks if a variable exists given its name and type.
 /// </summary>
 /// <param name="name">The name of the variable</param>
 /// <param name="type">The type of the variable</param>
 /// <returns>True if the variable exists and matches the given type</returns>
 public bool VariableExists(string name, CVar.VarType type)
 {
     return(All.Any(v => v.Name == name && v.Type == type));
 }