本文整理汇总了C#中StringTemplate.Warning方法的典型用法代码示例。如果您正苦于以下问题:C# StringTemplate.Warning方法的具体用法?C# StringTemplate.Warning怎么用?C# StringTemplate.Warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringTemplate
的用法示例。
在下文中一共展示了StringTemplate.Warning方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleExprOptions
/// <summary>Grab and cache options; verify options are valid</summary>
private void HandleExprOptions(StringTemplate self)
{
// make sure options don't use format / renderer. They are usually
// strings which might invoke a string renderer etc...
formatString = null;
StringTemplateAST wrapAST = (StringTemplateAST)GetOption("wrap");
if (wrapAST != null)
{
wrapString = EvaluateExpression(self, wrapAST);
}
StringTemplateAST nullValueAST = (StringTemplateAST)GetOption("null");
if (nullValueAST != null)
{
nullValue = EvaluateExpression(self, nullValueAST);
}
StringTemplateAST separatorAST = (StringTemplateAST)GetOption("separator");
if (separatorAST != null)
{
separatorString = EvaluateExpression(self, separatorAST);
}
// following addition inspired by John Snyders
StringTemplateAST formatAST = (StringTemplateAST)GetOption("format");
if (formatAST != null)
{
formatString = EvaluateExpression(self, formatAST);
}
// Check that option is valid
if (options != null)
{
IEnumerator iter = options.Keys.GetEnumerator();
while (iter.MoveNext())
{
string option = (string)iter.Current;
if (!supportedOptions.Contains(option))
{
self.Warning("ignoring unsupported option: " + option);
}
}
}
}
示例2: HandleExprOptions
/** <summary>Grab and cache options; verify options are valid</summary> */
protected virtual void HandleExprOptions( StringTemplate self )
{
// make sure options don't use format / renderer. They are usually
// strings which might invoke a string renderer etc...
_formatString = null;
StringTemplateAST wrapAST = (StringTemplateAST)GetOption( "wrap" );
if ( wrapAST != null )
{
_wrapString = EvaluateExpression( self, wrapAST );
}
StringTemplateAST nullValueAST = (StringTemplateAST)GetOption( "null" );
if ( nullValueAST != null )
{
_nullValue = EvaluateExpression( self, nullValueAST );
}
StringTemplateAST separatorAST = (StringTemplateAST)GetOption( "separator" );
if ( separatorAST != null )
{
_separatorString = EvaluateExpression( self, separatorAST );
}
// following addition inspired by John Snyders
StringTemplateAST formatAST =
(StringTemplateAST)GetOption( "format" );
if ( formatAST != null )
{
_formatString = EvaluateExpression( self, formatAST );
}
// Check that option is valid
if ( _options != null )
{
foreach ( string option in _options.Keys )
{
if ( !_supportedOptions.Contains( option ) )
self.Warning( "ignoring unsupported option: " + option );
}
}
}