Advertisement
emysaez

ExampleLinq.cs

May 24th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. //
  2. // ********************************
  3. // Created by Emy sáez. on 24/05/19.
  4. // Copyright (C) Spectrus 2019. All rights reserved.
  5. // ********************************
  6. //
  7.  
  8. using System;
  9. using System.Linq;
  10.  
  11. namespace test
  12. {
  13.     public class ExampleLinq
  14.     {
  15.        // expresión linq
  16.        public static bool ContainsExtension(string path)
  17.        {
  18.             bool result = extensions.Count<String>(x => path.Contains(x)) == 1 ? true : false; // si path contiene 1 extensión        
  19.             return result;
  20.        }
  21.        
  22.        private String[] extensions = new String[]
  23.        {
  24.             ".png",
  25.             ".jpg",
  26.             ".bmp",
  27.             ".gif"
  28.        };
  29.  
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement