本文整理汇总了C#中ITypeProvider.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ITypeProvider.GetType方法的具体用法?C# ITypeProvider.GetType怎么用?C# ITypeProvider.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITypeProvider
的用法示例。
在下文中一共展示了ITypeProvider.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetContextType
internal static Type GetContextType(ITypeProvider typeProvider, Activity currentActivity)
{
Type contextType = null;
string className = String.Empty;
Activity rootActivity = null;
if (Helpers.IsActivityLocked(currentActivity))
{
rootActivity = Helpers.GetDeclaringActivity(currentActivity);
}
else
{
rootActivity = Helpers.GetRootActivity(currentActivity);
}
if (rootActivity != null)
{
className = rootActivity.GetValue(WorkflowMarkupSerializer.XClassProperty) as string;
if (!String.IsNullOrEmpty(className))
contextType = typeProvider.GetType(className, false);
if (contextType == null)
contextType = typeProvider.GetType(rootActivity.GetType().FullName);
// If all else fails (likely, we don't have a type provider), it's the root activity type.
if (contextType == null)
contextType = rootActivity.GetType();
}
return contextType;
}
示例2: ParseTypeName
internal static Type ParseTypeName(ITypeProvider typeProvider, SupportedLanguages language, string typeName)
{
Type returnType = null;
returnType = typeProvider.GetType(typeName, false);
if (returnType == null)
{
string simpleTypeName = String.Empty;
string decoratorString = String.Empty;
string[] parameters = null;
if (ParseTypeName(typeName, language == SupportedLanguages.CSharp ? ParseTypeNameLanguage.CSharp : ParseTypeNameLanguage.VB, out simpleTypeName, out parameters, out decoratorString))
{
returnType = typeProvider.GetType(simpleTypeName + decoratorString, false);
}
}
return returnType;
}
示例3: ParseTypeName
internal static Type ParseTypeName(ITypeProvider typeProvider, System.Workflow.Activities.Common.SupportedLanguages language, string typeName)
{
Type type = null;
type = typeProvider.GetType(typeName, false);
if (type == null)
{
string str = string.Empty;
string elemantDecorator = string.Empty;
string[] parameters = null;
if (ParseTypeName(typeName, (language == System.Workflow.Activities.Common.SupportedLanguages.CSharp) ? ParseTypeNameLanguage.CSharp : ParseTypeNameLanguage.VB, out str, out parameters, out elemantDecorator))
{
type = typeProvider.GetType(str + elemantDecorator, false);
}
}
return type;
}
示例4: GetContextType
internal static Type GetContextType(ITypeProvider typeProvider, Activity currentActivity)
{
Type type = null;
string str = string.Empty;
Activity declaringActivity = null;
if (System.Workflow.Activities.Common.Helpers.IsActivityLocked(currentActivity))
{
declaringActivity = System.Workflow.Activities.Common.Helpers.GetDeclaringActivity(currentActivity);
}
else
{
declaringActivity = System.Workflow.Activities.Common.Helpers.GetRootActivity(currentActivity);
}
if (declaringActivity != null)
{
str = declaringActivity.GetValue(WorkflowMarkupSerializer.XClassProperty) as string;
if (!string.IsNullOrEmpty(str))
{
type = typeProvider.GetType(str, false);
}
if (type == null)
{
type = typeProvider.GetType(declaringActivity.GetType().FullName);
}
if (type == null)
{
type = declaringActivity.GetType();
}
}
return type;
}