本文整理汇总了C#中ModelType.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ModelType.GetType方法的具体用法?C# ModelType.GetType怎么用?C# ModelType.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelType
的用法示例。
在下文中一共展示了ModelType.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAvailableAnalyzeOptions
/// <summary>
/// Retrieves available analyze options for specified research type and model type.
/// </summary>
/// <param name="rt">Research type.</param>
/// <param name="mt">Model type.</param>
/// <returns>Available analyze options.</returns>
/// <note>Analyze option is available for research, if it is available
/// both for research type and model type.</note>
public static AnalyzeOption GetAvailableAnalyzeOptions(ResearchType rt, ModelType mt)
{
ResearchTypeInfo[] rInfo = (ResearchTypeInfo[])rt.GetType().GetField(rt.ToString()).GetCustomAttributes(typeof(ResearchTypeInfo), false);
Type researchType = Type.GetType(rInfo[0].Implementation, true);
AvailableAnalyzeOption rAvailableOptions = ((AvailableAnalyzeOption[])researchType.GetCustomAttributes(typeof(AvailableAnalyzeOption), true))[0];
ModelTypeInfo[] mInfo = (ModelTypeInfo[])mt.GetType().GetField(mt.ToString()).GetCustomAttributes(typeof(ModelTypeInfo), false);
Type modelType = Type.GetType(mInfo[0].Implementation, true);
AvailableAnalyzeOption mAvailableOptions = ((AvailableAnalyzeOption[])modelType.GetCustomAttributes(typeof(AvailableAnalyzeOption), true))[0];
return rAvailableOptions.Options & mAvailableOptions.Options;
}
示例2: GetRequiredGenerationParameters
/// <summary>
/// Returns list of generation parameters which are required for specified research.
/// </summary>
/// <param name="id">ID of research.</param>
/// <returns>List of generation parameters.</returns>
public static List<GenerationParameter> GetRequiredGenerationParameters(ResearchType rt,
ModelType mt, GenerationType gt)
{
List<GenerationParameter> gp = new List<GenerationParameter>();
if (rt == ResearchType.Collection ||
rt == ResearchType.Structural)
return gp;
if (gt == GenerationType.Static)
{
gp.Add(GenerationParameter.AdjacencyMatrix);
return gp;
}
ModelTypeInfo[] info = (ModelTypeInfo[])mt.GetType().GetField(mt.ToString()).GetCustomAttributes(typeof(ModelTypeInfo), false);
Type t = Type.GetType(info[0].Implementation, true);
RequiredGenerationParameter[] rRequiredGenerationParameters = (RequiredGenerationParameter[])t.GetCustomAttributes(typeof(RequiredGenerationParameter), true);
for (int i = 0; i < rRequiredGenerationParameters.Length; ++i)
{
GenerationParameter g = rRequiredGenerationParameters[i].Parameter;
if (g != GenerationParameter.AdjacencyMatrix)
gp.Add(g);
}
return gp;
}
示例3: CreateNetworkByType
public static AbstractNetwork CreateNetworkByType(ModelType mt, String rName,
GenerationType gType,
Dictionary<ResearchParameter, object> rParams,
Dictionary<GenerationParameter, object> genParams,
AnalyzeOption AnalyzeOptions)
{
ModelTypeInfo[] info = (ModelTypeInfo[])mt.GetType().GetField(mt.ToString()).GetCustomAttributes(typeof(ModelTypeInfo), false);
Type t = Type.GetType(info[0].Implementation);
Type[] constructTypes = new Type[] {
typeof(String),
typeof(GenerationType),
typeof(Dictionary<ResearchParameter, object>),
typeof(Dictionary<GenerationParameter, object>),
typeof(AnalyzeOption) };
object[] invokeParams = new object[] {
rName,
gType,
rParams,
genParams,
AnalyzeOptions };
return (AbstractNetwork)t.GetConstructor(constructTypes).Invoke(invokeParams);
}