/// <summary> /// Adds the new item. /// </summary> /// <returns><c>true</c>, if new item was added, /// <c>false</c> otherwise.</returns> /// <param name="dataStruct">Data struct.</param> public static bool AddNewItem(CylinderVolumeStruct dataStruct) { bool retVal = false; const string ErrMsg = "Invalid argument passed."; const string MethodName = "public static bool AddNewItem(" + "CubicAreaSCylinderStruct dataStruct)"; try { dataList.Add(dataStruct); // All ok return true. retVal = true; return(retVal); } catch (ArgumentException ex) { myMsg.BuildErrorString( MyClassName, MethodName, ErrMsg, ex.ToString()); return(false); } }
/// <summary> /// Gets the item at index. /// </summary> /// <returns>The /// <see cref="BuildingFormulas.CubicAreaSquareRectangleStruct"/>. /// </returns> /// <param name="index">The index.</param> public static CylinderVolumeStruct GetItemAt(int index) { CylinderVolumeStruct dataStruct = new CylinderVolumeStruct(); const string MethodName = "public static " + "CubicAreaCylinderStruct GetItemAt(" + "int index)"; try { dataStruct = dataList[index]; return(dataStruct); } catch (IndexOutOfRangeException ex) { string errMsg = "Encountered error while removing item at: " + index; myMsg.BuildErrorString( MyClassName, MethodName, errMsg, ex.ToString()); return(dataStruct); } catch (ArgumentException ex) { const string ErrMsg = "Encountered error with argument."; myMsg.BuildErrorString( MyClassName, MethodName, ErrMsg, ex.ToString()); return(dataStruct); } }