本文整理汇总了C#中INetwork.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# INetwork.GetType方法的具体用法?C# INetwork.GetType怎么用?C# INetwork.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INetwork
的用法示例。
在下文中一共展示了INetwork.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetProperties
public string GetProperties(INetwork network)
{
var sb = new StringBuilder();
if (network == null)
{
sb.AppendLine("network is null");
}
else
{
ListPropertiesOfNetworkBase(network, sb);
if (network is IAdjList)
{
ListPropertiesOfAdjList((IAdjList)network, sb);
}
else
{
var isMatrix = network.GetType().GetInterfaces()
.Where(t => t.IsGenericType)
.Select(t => t.GetGenericTypeDefinition())
.Any(t => t.Equals(typeof(IMatrix<>)));
if (isMatrix)
ListPropertiesOfMatrix(network, sb);
}
}
return sb.ToString();
}
示例2: ExtractKthCore
internal int ExtractKthCore(INetwork network, int kValue)
{
int removed = 0;
if (network is IBasicAdjList)
removed = ExtractKthCoreFromAdjList(network as IBasicAdjList, kValue);
else
{
var isMatrix = network.GetType().GetInterfaces()
.Where(t => t.IsGenericType)
.Select(t => t.GetGenericTypeDefinition())
.Any(t => t.Equals(typeof(IMatrix<>)));
if (isMatrix)
removed = ExtractKthCoreFromMatrix(network, kValue);
}
return removed;
}
示例3: ListPropertiesOfNetworkBase
public void ListPropertiesOfNetworkBase(INetwork network, StringBuilder sb)
{
sb.AppendLine(string.Format("Id: {0}", network.Id));
sb.AppendLine(string.Format("Name: \"{0}\"", network.Name));
sb.AppendLine(string.Format("Node count: {0}", network.NodeCount));
sb.AppendLine(string.Format("Edge count: {0}", network.EdgeCount));
sb.AppendLine(string.Format("Directed: {0}", network.IsDirected));
sb.AppendLine(string.Format("Structure: {0}", network.Structure));
sb.AppendLine(string.Format("Implementation: {0}", network.GetType().Name));
}