当前位置: 首页>>代码示例>>C#>>正文


C# DataType.ToErrorTypeString方法代码示例

本文整理汇总了C#中DataType.ToErrorTypeString方法的典型用法代码示例。如果您正苦于以下问题:C# DataType.ToErrorTypeString方法的具体用法?C# DataType.ToErrorTypeString怎么用?C# DataType.ToErrorTypeString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataType的用法示例。


在下文中一共展示了DataType.ToErrorTypeString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BadArgumentNoValue

		/// <summary>
		/// Creates a ScriptRuntimeException with a predefined error message specifying that
		/// a function was called with no value when a value was required.
		/// 
		/// This function creates a message like "bad argument #xxx to 'yyy' (zzz expected, got no value)"
		/// while <see cref="BadArgumentValueExpected" /> creates a message like "bad argument #xxx to 'yyy' (value expected)"
		/// </summary>
		/// <param name="argNum">The argument number (0-based).</param>
		/// <param name="funcName">Name of the function generating this error.</param>
		/// <param name="expected">The expected data type.</param>
		/// <returns>
		/// The exception to be raised.
		/// </returns>
		public static ScriptRuntimeException BadArgumentNoValue(int argNum, string funcName, DataType expected)
		{
			return new ScriptRuntimeException("bad argument #{0} to '{1}' ({2} expected, got no value)",
				argNum + 1, funcName, expected.ToErrorTypeString());
		}
开发者ID:eddy5641,项目名称:LuaSharp,代码行数:18,代码来源:ScriptRuntimeException.cs

示例2: AttemptToCallNonFunc

		/// <summary>
		/// Creates a ScriptRuntimeException with a predefined error message specifying that
		/// an attempt to call a non-function was made
		/// </summary>
		/// <param name="type">The lua non-function data type.</param>
		/// <param name="debugText">The debug text to aid location (appears as "near 'xxx'").</param>
		/// <returns></returns>
		public static ScriptRuntimeException AttemptToCallNonFunc(DataType type, string debugText = null)
		{
			string functype = type.ToErrorTypeString();

			if (debugText != null)
				return new ScriptRuntimeException("attempt to call a {0} value near '{1}'", functype, debugText);
			else
				return new ScriptRuntimeException("attempt to call a {0} value", functype);
		}
开发者ID:eddy5641,项目名称:LuaSharp,代码行数:16,代码来源:ScriptRuntimeException.cs

示例3: BadArgument

		/// <summary>
		/// Creates a ScriptRuntimeException with a predefined error message specifying that
		/// a function was called with a bad argument
		/// </summary>
		/// <param name="argNum">The argument number (0-based).</param>
		/// <param name="funcName">Name of the function generating this error.</param>
		/// <param name="expected">The expected data type.</param>
		/// <param name="got">The data type received.</param>
		/// <param name="allowNil">True if nils were allowed in this call.</param>
		/// <returns>
		/// The exception to be raised.
		/// </returns>
		public static ScriptRuntimeException BadArgument(int argNum, string funcName, DataType expected, DataType got, bool allowNil)
		{
			return BadArgument(argNum, funcName, expected.ToErrorTypeString(), got.ToErrorTypeString(), allowNil);
		}
开发者ID:eddy5641,项目名称:LuaSharp,代码行数:16,代码来源:ScriptRuntimeException.cs


注:本文中的DataType.ToErrorTypeString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。