コード例 #1
0
ファイル: Program.cs プロジェクト: iCodeIT/LinqExtensions
        static void Main(string[] args)
        {
            var numbers = new[] { 2, 1, 5, 6, 9, 3, 7, 8, 4 };
              var evenNumbersAbove3EnumerateAtOnce = numbers.Dump(true, "numbers")
            .Where(x => x % 2 == 0).Dump(true, "Even")
            .Where(x => x > 3).Dump(true, "gt3")
            .Distinct().Dump(true, "Distinct")
            .OrderBy(x => x).Dump(true, "Ordered");

              Debug.WriteLine("------------------------------");

              var evenNumbersAbove3LazyEval = numbers.Dump(false, "numbers")
            .Where(x => x % 2 == 0).Dump(false, "Even")
            .Where(x => x > 3).Dump(false, "gt3")
            .Distinct().Dump(false, "Distinct")
            .OrderBy(x => x).Dump(false, "Ordered").ToList();

              Console.WriteLine("3 in numbers: " + 3.In(numbers));
              Console.WriteLine("10 in numbers: " + 10.In(numbers));

              Console.WriteLine("MaxBy:"+numbers.MaxBy(x => x));
              Console.WriteLine("MinBy:" + numbers.MinBy(x => x));

              Console.ReadKey();
        }
コード例 #2
0
		public void DumpFail()
		{
			var arrayOfA = new[] { new A { Value = "a" }, null, new A { Value = "b" } };
			Console.WriteLine(arrayOfA.Dump());
		}
コード例 #3
0
		public void Literal_Quote_In_String_Does_Not_Ignore_Comma()
		{
			var test = new
			{
				TestString = "test\"",
				OtherString = "$100,000"
			};

			var serialized = test.Dump();

			Assert.That(serialized, Is.EqualTo("{\r\n\tTestString: \"test\"\"\",\r\n\tOtherString: \"$100,000\"\r\n}"));
		}
コード例 #4
0
		public void Literal_Quote_In_String_Does_Not_Ignore_Comma()
		{
			var test = new
			{
				TestString = "test\"",
				OtherString = "$100,000"
			};

			var serialized = test.Dump();
			var lf = Environment.NewLine;

			Assert.That(serialized, Is.EqualTo("{"+lf+"\tTestString: \"test\"\"\","+lf+"\tOtherString: \"$100,000\""+lf+"}"));
		}
コード例 #5
0
 private static IRestResponse GetTile(GetTile request)
 {
     var client = new RestClient(new AppSettings().Get(BaseUrl, "http://localhost:8080"));
       var tileRequest = new RestRequest(RestParams(request));
       var log = typeof(TileFactory).Log();
       var msg = new
       {
     Common = request.ToGetUrl(),
     NonStandard = client.BuildUri(tileRequest)
       };
       log.DebugFormat("Tile request {0}", msg.Dump());
       IRestResponse tileResponse;
       try
       {
     tileResponse = client.ExecuteAsGet(tileRequest, HttpMethods.Get);
       }
       catch (Exception exc)
       {
     log.ErrorFormat("Issue: {0} at {1}", exc.Message, exc.StackTrace);
     throw;
       }
       return tileResponse;
 }