/// <summary> /// Gets the value of this object as a string. /// Throws an exception if the value is not a string. /// </summary> /// <returns></returns> public string AsString() { string s = PiLib.GetString(Pi.Handle, Name); if (s == null) { throw new InvalidOperationException($"The object {Name} is not a string."); } return(s); }