This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tuple = Tuple.Create("Pascal", "Paradis", "pascal.paradis@gmail.com", 26, Image.FromFile("pparadis_avatar.png")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//tiré de https://github.com/robconery/massive#code-please | |
dynamic table = new Products(); //"dynamic" is important here - don't use "var"! | |
var productsFour = table.Find(CategoryID:4,columns:"ProductName"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.IsNullOrEmpty = function(value) { | |
var isNullOrEmpty = true; | |
if (value) { | |
if (typeof (value) == 'string') { | |
if (value.length > 0) | |
isNullOrEmpty = false; | |
} | |
} | |
return isNullOrEmpty; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace NMemcached.Extensions | |
{ | |
public static class StringExtensions | |
{ | |
public static bool IsEmpty(this string s) | |
{ | |
return string.IsNullOrEmpty(s); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tuple = Tuple.Create("Pascal", "Paradis", "pascal.paradis@gmail.com", 26, Image.FromFile("pparadis_avatar.png")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Compression | |
{ | |
public class Compression | |
{ | |
public static void Compress(FileInfo fi) | |
{ | |
using (FileStream inFile = fi.OpenRead()) | |
{ | |
if ((File.GetAttributes(fi.FullName) & FileAttributes.Hidden) != FileAttributes.Hidden & fi.Extension != ".gz") | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (ZipFile zip = new ZipFile()) | |
{ | |
zip.AddFile("c:\\images\\personal\\7440-N49th.png", "images"); | |
zip.AddFile("c:\\Reports\\2008-Regional-Sales-Report.pdf", "files"); | |
zip.AddFile("ReadMe.txt"); | |
zip.Save("MyZipFile.zip"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (ZipArchive archive = ZipFile.Open(@"c:\start.zip", ZipArchiveMode.Update)) | |
{ | |
archive.CreateEntryFromFile(@"c:\test.txt", "test_compress.txt"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (ZipArchive archive = ZipFile.Open(@"c:\frenchcoding\start.zip", ZipArchiveMode.Create)) | |
{ | |
archive.CreateEntryFromFile(@"c:\frenchcoding\test.txt", "test_compress.txt"); | |
archive.CreateEntryFromFile(@"c:\frenchcoding\test2.txt", "test_compress2.txt"); | |
archive.CreateEntryFromFile(@"c:\frenchcoding\test3.txt", "test_compress3.txt"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (ZipArchive archive = ZipFile.Open(@"c:\frenchcoding\start.zip", ZipArchiveMode.Read)) | |
{ | |
archive.ExtractToDirectory(@"c:\frenchcoding\extract\"); | |
} |