本文整理汇总了C#中DataContext.GetPreviousStatement方法的典型用法代码示例。如果您正苦于以下问题:C# DataContext.GetPreviousStatement方法的具体用法?C# DataContext.GetPreviousStatement怎么用?C# DataContext.GetPreviousStatement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataContext
的用法示例。
在下文中一共展示了DataContext.GetPreviousStatement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanExecute
/// <summary>Determines whether this instance can execute the specified context.</summary>
/// <param name="context">The context.</param>
/// <param name="parameters">The parameters.</param>
/// <returns><c>true</c> if this instance can execute the specified context; otherwise, <c>false</c>.</returns>
public override bool CanExecute(DataContext context, Dictionary<string, string> parameters)
{
var statement = context.GetPreviousStatement();
if (statement == null)
{
return false;
}
return context.GetIterator(parameters, statement);
}
开发者ID:JakobChristensen,项目名称:Resharper.PredictiveCodeSuggestions,代码行数:14,代码来源:AfterEnumerableScope.cs
示例2: GetModel
/// <summary>Gets the model.</summary>
/// <param name="context">The context.</param>
/// <returns>Returns the model.</returns>
private Model GetModel(DataContext context)
{
var treeNode = context.TreeNode;
if (treeNode == null)
{
return null;
}
var statement = context.GetPreviousStatement() as IDeclarationStatement;
if (statement == null)
{
return null;
}
foreach (var variableDeclaration in statement.VariableDeclarations)
{
if (!this.IsEnumerable(variableDeclaration.Type))
{
continue;
}
var typeName = variableDeclaration.Type.GetLongPresentableName(CSharpLanguage.Instance);
if (typeName == "string" || typeName == "System.String")
{
continue;
}
return new Model
{
VariableName = variableDeclaration.DeclaredName,
TypeName = typeName
};
}
return null;
}