本文整理汇总了C#中Pipeline.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Pipeline.Select方法的具体用法?C# Pipeline.Select怎么用?C# Pipeline.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pipeline
的用法示例。
在下文中一共展示了Pipeline.Select方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestPathPipe
public void TestPathPipe()
{
var _graph = DemoGraphFactory.CreateSimpleGraph();
var Alice = _graph.VertexById("Alice").AsMutable();
var _Pipe1 = new OutEdgesPipe<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>();
var _Pipe2 = new InVertexPipe<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>();
var _Pipe3 = new PathPipe<IReadOnlyGenericPropertyVertex<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>>();
var _Pipeline = new Pipeline<IReadOnlyGenericPropertyVertex<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>,
IEnumerable<Object>>(_Pipe1, _Pipe2, _Pipe3);
_Pipeline.SetSource(new SingleEnumerator<IReadOnlyGenericPropertyVertex<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>>(Alice));
// Via pipeline...
var query1 = _Pipeline.Select(path => path.Select(q => ((IIdentifier<String>) q).Id)).ToArray();
Assert.AreEqual(3, query1.Length);
Assert.AreEqual(3, query1[0].Count(), "'" + query1[0].AggString() + "' is invalid!");
Assert.AreEqual(3, query1[1].Count(), "'" + query1[1].AggString() + "' is invalid!");
Assert.AreEqual(3, query1[2].Count(), "'" + query1[2].AggString() + "' is invalid!");
Assert.AreEqual("Alice|Alice -loves-> Bob|Bob", query1[0].AggString());
Assert.AreEqual("Alice|0|Bob", query1[1].AggString());
Assert.AreEqual("Alice|2|Carol", query1[2].AggString());
// Via extention methods...
var query2 = Alice.OutE().InV().Paths().ToArray();
Assert.AreEqual(3, query2.Length);
Assert.AreEqual(3, query2[0].Count(), "'" + query2[0].Select(q => ((IIdentifier<String>) q).Id).AggString() + "' is invalid!");
Assert.AreEqual(3, query2[1].Count(), "'" + query2[1].Select(q => ((IIdentifier<String>) q).Id).AggString() + "' is invalid!");
Assert.AreEqual(3, query2[2].Count(), "'" + query2[2].Select(q => ((IIdentifier<String>) q).Id).AggString() + "' is invalid!");
var query3 = Alice.Out().Paths().ToArray();
Assert.AreEqual(3, query2.Length);
Assert.AreEqual(3, query2[0].Count(), "'" + query2[0].Select(q => ((IIdentifier<String>) q).Id).AggString() + "' is invalid!");
Assert.AreEqual(3, query2[1].Count(), "'" + query2[1].Select(q => ((IIdentifier<String>) q).Id).AggString() + "' is invalid!");
Assert.AreEqual(3, query2[2].Count(), "'" + query2[2].Select(q => ((IIdentifier<String>) q).Id).AggString() + "' is invalid!");
}
示例2: Main
//#region (static) StartMonoCSharpREPLShell(Args)
///// <summary>
///// The Mono C# REPL Shell
///// </summary>
//public static void StartMonoCSharpREPLShell(params String[] Args)
//{
// #region Feel free to step through...
// _Compiler = new Runner();
// var a = _Compiler.Execute("Math.Abs(-42);");
// var b = _Compiler.Execute("Math.Sin(Math.PI / 6);");
// var c = _Compiler.Execute("class Fact { public int Run(int n) { return n <= 0 ? 1 : n*Run(n-1); } }");
// var d = _Compiler.Execute("new Fact().Run(5);");
// var e = _Compiler.Execute("\"abcdefgh\".Substring(1, 2);");
// var f = _Compiler.Execute("class Echo { public Object Print(Object o) { return o; } }");
// var g = _Compiler.Execute("var test = 123;");
// var h = _Compiler.Execute("new Echo().Print(test);");
// #endregion
// #region Start the interactive (read-eval-print loop) shell...
// var _Report = new Report(new ConsoleReportPrinter());
// var _CLP = new CommandLineParser(_Report);
// _CLP.UnknownOptionHandler += Mono.Driver.HandleExtraArguments;
// var _Settings = _CLP.ParseArguments(Args);
// if (_Settings == null || _Report.Errors > 0)
// Environment.Exit(1);
// var _Evaluator = new Evaluator(_Settings, _Report)
// {
// InteractiveBaseClass = typeof(InteractiveBaseShell),
// DescribeTypeExpressions = true
// };
// //// Adding a assembly twice will lead to delayed errors...
// //_Evaluator.ReferenceAssembly(typeof(YourAssembly).Assembly);
// _Evaluator.ReferenceAssembly(typeof(Bragi).Assembly);
// _Evaluator.ReferenceAssembly(typeof(IPropertyGraph).Assembly);
// _Evaluator.ReferenceAssembly(typeof(GraphFactory).Assembly);
// var u1 = _Compiler.Execute("using de.ahzf.Bragi;");
// var u2 = _Compiler.Execute("using de.ahzf.Blueprints;");
// var u3 = _Compiler.Execute("using de.ahzf.Balder.PropertyGraphs;");
// var u4 = _Compiler.Execute("using de.ahzf.Balder.PropertyGraphs.InMemory");
// var _CSharpShell = new CSharpShell(_Evaluator, "BragiShell").Run();
// #endregion
//}
//#endregion
/// <summary>
/// Main...
/// </summary>
/// <param name="Args">Arguments...</param>
public static void Main(String[] Args)
{
var _graph = DemoGraphFactory.CreateSimpleGraph();
var Alice = _graph.VertexById("Alice").AsMutable();
var _Pipe1 = new OutEdgesPipe<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>();
var _Pipe2 = new InVertexPipe<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>();
var _Pipe3 = new PathPipe<IReadOnlyGenericPropertyVertex<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>>();
var _Pipeline = new Pipeline<IReadOnlyGenericPropertyVertex<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>,
IEnumerable<Object>>(_Pipe1, _Pipe2, _Pipe3);
_Pipeline.SetSource(new SingleEnumerator<IReadOnlyGenericPropertyVertex<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>>(Alice));
var x1 = _Pipeline.Select(path => path.Select(q => ((IIdentifier<String>)q).Id).Aggregate((a, b) => a + "|" + b));
var x2 = Alice.OutE().InV().Paths().ToArray();
foreach (var _Path in x1)
{
//var a0 = _Path.ElementAt(0);
//var b0 = _Path.ElementAt(1) is IReadOnlyGenericPropertyEdge <String, Int64, String, String, Object,
// String, Int64, String, String, Object,
// String, Int64, String, String, Object,
// String, Int64, String, String, Object>;
//var c0 = _Path.ElementAt(2) is IReadOnlyGenericPropertyVertex<String, Int64, String, String, Object,
// String, Int64, String, String, Object,
// String, Int64, String, String, Object,
// String, Int64, String, String, Object>;
}
//.........这里部分代码省略.........