本文整理汇总了C#中QueriableDummy.Select方法的典型用法代码示例。如果您正苦于以下问题:C# QueriableDummy.Select方法的具体用法?C# QueriableDummy.Select怎么用?C# QueriableDummy.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueriableDummy
的用法示例。
在下文中一共展示了QueriableDummy.Select方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrettyPrintSimpleQuery
public void PrettyPrintSimpleQuery()
{
var q = new QueriableDummy<ntup>();
var r = q.Select(rq => rq.run * 2).PrettyPrintQuery();
Console.WriteLine(r);
Assert.IsTrue(r.Contains("select"));
Assert.IsTrue(r.Contains("[rq].run * 2"));
}
示例2: PrettyPrintHideTuples
public void PrettyPrintHideTuples()
{
var q = new QueriableDummy<ntup>();
var r = q.Select(rq => Tuple.Create(rq.run * 2, 1)).Select(rq => rq.Item1).PrettyPrintQuery();
Console.WriteLine(r);
Assert.IsFalse(r.Contains("Tuple"));
Assert.IsTrue(r.Contains("[rq].run * 2"));
}
示例3: CacheObjectWhenCPPChanges
public void CacheObjectWhenCPPChanges()
{
TestUtils.ResetLINQLibrary();
// Make sure that when the C++ code changes, the cache key for lookup of results will also change.
var q = new QueriableDummy<ntup>();
var i = q.Select(e => DoItClass.DoIt(e.run)).Where(x => x > 2).Count();
var query = DummyQueryExectuor.LastQueryModel;
// Look for a hash value.
var str1 = FormattingQueryVisitor.Format(query);
Console.WriteLine(str1);
var m = Regex.Match(str1, @"DoIt([^\(]+)");
Assert.IsTrue(m.Success);
}
示例4: QueryTupleWithBadType
/// <summary>
/// Generate a tree against a byte, a type that we don't currently support.
/// </summary>
private static void QueryTupleWithBadType()
{
var q = new QueriableDummy<singleIntNtuple>();
q
.Select(e => new customObjectWithByte() { Var1 = (byte)(e.run + 1) })
.AsTTree("DataTree", "not going to happen", null, "c1", "c2");
}
示例5: QueryTupleOurCustomObjectTitleAndNameDefaultFile
/// <summary>
/// Simple query for a customized object.
/// </summary>
private static void QueryTupleOurCustomObjectTitleAndNameDefaultFile()
{
var q = new QueriableDummy<singleIntNtuple>();
q
.Select(e => new ourCustomObject() { col1 = e.run, col2 = (int)e.run + 1, col3 = e.run + 2 })
.AsTTree("PhysicsTree", "Data that we've written for a physics tree");
}
示例6: QueryTupleAllTypes
/// <summary>
/// Generage a query that fills all variable type.
/// </summary>
private static void QueryTupleAllTypes()
{
var q = new QueriableDummy<singleIntNtuple>();
q
.Select(e => new customObjectAllValidTypes() { vDouble = (double)e.run, vBool = e.run == 10, vInt = (int)e.run })
.AsTTree(outputROOTFile: new FileInfo("allguys.root"));
}
示例7: QueryTupleOurCustomObjectCustomLeafNames
/// <summary>
/// Reset the leaf names
/// </summary>
private static void QueryTupleOurCustomObjectCustomLeafNames()
{
var q = new QueriableDummy<singleIntNtuple>();
q
.Select(e => new ourCustomObject() { col1 = e.run, col2 = (int)e.run + 1, col3 = e.run + 2 })
.AsTTree("DataTree", "this is a test", null, "c1", "c2");
}
示例8: QueryTupleAnonyoumsObject
/// <summary>
/// Create a query with an anonymous object.
/// </summary>
private static void QueryTupleAnonyoumsObject()
{
var q = new QueriableDummy<singleIntNtuple>();
q
.Select(e => new { col2 = (int)e.run + 1, col3 = e.run + 2, col1 = e.run})
.AsTTree(outputROOTFile: new FileInfo("hi.root"));
}
示例9: QueryTupleOurCustomObjectMissingVar
/// <summary>
/// We forget to initalize a varaible. Use to make sure the system gives a good
/// error so the user can figure out what is going on.
/// </summary>
private static void QueryTupleOurCustomObjectMissingVar()
{
var q = new QueriableDummy<singleIntNtuple>();
q
.Select(e => new ourCustomObject() { col2 = (int)e.run + 1, col3 = e.run + 2 })
.AsTTree(outputROOTFile: new FileInfo("hi.root"));
}
示例10: CacheWhenIncludesChange
public void CacheWhenIncludesChange()
{
// Make sure that when the C++ code changes, the cache key for lookup of results will also change.
var q = new QueriableDummy<ntup>();
var mym = new MyModifiableCode();
mym.LOC = new string[] { "int i = 0;", "MultBy2 = 10;" };
var i = q.Select(e => mym.MultBy2(e.run)).Where(x => x > 2).Count();
var query = DummyQueryExectuor.LastQueryModel;
// Set the LOC to something.
mym.Includes = new string[] { "TMVAReader.h" };
var str1 = FormattingQueryVisitor.Format(query);
mym.Includes = new string[] { "TFile.h" };
var str2 = FormattingQueryVisitor.Format(query);
Console.WriteLine(str1);
Console.WriteLine(str2);
Assert.AreNotEqual(str1, str2);
}
示例11: BadObjectMultBy2
public void BadObjectMultBy2()
{
// An end-to-end code test to see if we can generate code to multiply by 2.
var q = new QueriableDummy<ntup>();
var mym = new MyBrokenCode();
var i = q.Select(e => mym.MultBy2(e.run)).Where(x => x > 2).Count();
}
示例12: SimpleMultBy2
public void SimpleMultBy2()
{
// An end-to-end code test to see if we can generate code to multiply by 2.
var q = new QueriableDummy<ntup>();
var mym = new MyCode();
var i = q.Select(e => mym.MultBy2(e.run)).Where(x => x > 2).Count();
DummyQueryExectuor.FinalResult.DumpCodeToConsole();
Assert.IsTrue(DummyQueryExectuor.FinalResult.DumpCode().Where(l => l.Contains("*2")).Any());
}