Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Contador de bytes do Desafio 2
using System;
using System.IO;
using System.Linq;
namespace Desafio2
class Program
private static string[] EXTENSIONS = new string[] {
".exe", ".log", ".pdb", ".js", ".html", ".htm",
".xhtml", ".xsl", ".xslt", ".hta", ".txt", ".css", ".dll", ".obj"
private static bool ShouldCountLength(FileInfo fileInfo)
return fileInfo != null
&& (from e in EXTENSIONS where e == fileInfo.Extension select true).FirstOrDefault();
static void Main(string[] args)
var directory = @"c:\TMP\tst";
Console.WriteLine(string.Format("Total Size: '{0}' bytes",
Directory.EnumerateFiles(directory, "*.*", SearchOption.AllDirectories)
.Select(f => new FileInfo(f))
.Select(fi => fi.Length)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.