Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Mww66
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             IEnumerable<int> result = from value in Enumerable.Range(0, 100)
  15.                                       select value;
  16.  
  17.             List<string> elements = new List<string> { "cat", "dog", "bird" };
  18.             List<int> ielements = new List<int> { 1,2,3 };
  19.             foreach (var value in elements)
  20.             {
  21.                 //Console.WriteLine(value);
  22.             }
  23.  
  24.             System.Console.WriteLine(elements.IsEmpty());
  25.             System.Console.WriteLine(result.Mean());
  26.  
  27.             System.Console.ReadKey();
  28.         }
  29.     }
  30.  
  31.     public static class IenumerableExtend
  32.     {
  33.         public static bool IsEmpty<T>(this IEnumerable<T> input)
  34.         {
  35.             return input != null && input.Any();
  36.         }
  37.  
  38.         public static int Mean(this IEnumerable<int> input)
  39.         {
  40.             int x = 3;
  41.             return x;
  42.         }
  43.         public static void Mean(this IEnumerable<float> input)
  44.         {
  45.             //
  46.         }
  47.  
  48.         public static void MeanLength(this IEnumerable<string> input)
  49.         {
  50.             //
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement