Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Mww66
- {
- class Program
- {
- static void Main(string[] args)
- {
- IEnumerable<int> result = from value in Enumerable.Range(0, 100)
- select value;
- List<string> elements = new List<string> { "cat", "dog", "bird" };
- List<int> ielements = new List<int> { 1,2,3 };
- foreach (var value in elements)
- {
- //Console.WriteLine(value);
- }
- System.Console.WriteLine(elements.IsEmpty());
- System.Console.WriteLine(result.Mean());
- System.Console.ReadKey();
- }
- }
- public static class IenumerableExtend
- {
- public static bool IsEmpty<T>(this IEnumerable<T> input)
- {
- return input != null && input.Any();
- }
- public static int Mean(this IEnumerable<int> input)
- {
- int x = 3;
- return x;
- }
- public static void Mean(this IEnumerable<float> input)
- {
- //
- }
- public static void MeanLength(this IEnumerable<string> input)
- {
- //
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement