1
2
3
4
  List<Document> documents = documentLayer.GetDocuments(username);
  List<Document> filteredDocuments = new List<Document>();

...

C# Filterting a List<> w...

by mantis7.myopenid.com, November 25, 2008 16:33, 2 refactorings, tagged with regular expression, C#, List, filter

Have the below code which f...

Avatar Talk
1
2
3
4
/// <summary>
/// Test to see if the type can be XML serialized
/// </summary>
...

C# Check type is XML Serializable

by sbehnke.myopenid.com, November 19, 2008 22:23, 2 refactorings

I need a fast method to che...

Avatar Talk
1
2
3
4
public static class DirectoryInfoExtensions
{
    public static void CopyTo(this String Source, String Destination, Boolean Overwrite)
...

C# DirectoryInfo.CopyTo

by GateKiller, November 11, 2008 17:10, 3 refactorings, tagged with C#, .net, directoryinfo, copyto

Because the .NET Framework ...

98c852e2d9b26249745ea92c72964d3f Talk
1
2
3
4
public static class HtmlHelper {
    public static string StripHtmlComments(string html) {
        if (html == null) {
...

C# Strip Html Comments

by Haacked, November 11, 2008 01:14, 2 refactorings, tagged with html parse

Procedural style code to st...

Cdf546b601bf29a7eb4ca777544d11cd Talk
1
2
3
4
public static class DependencySorter<T>
{
    public static IEnumerable<T> Sort(Dictionary<T, IEnumerable<T>> dependencies)
...

C# Sorting by dependencies

by rikkus, November 05, 2008 12:14, 3 refactorings, tagged with recursion

This code sorts a collectio...

22e33503870d8e20493c4dd6b2f9767f Talk
1
2
3
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
...

C# CSLA 3.5 property snippet

by John, October 17, 2008 18:41, No refactoring, tagged with csla, snippet, intellisense

I'm sure I'm not the first ...

9cef2beb18f68b1b7fe18758a14f4e5a Talk
1
2
3
DateTime todayUTC = DateTime.Today.ToUniversalTime();
DateTime currentTimeUTC = todayUTC;
...

C# Generating a list of time v...

by fezmonkey, October 16, 2008 22:06, 3 refactorings, tagged with date, time, C#

I need to generate a list o...

3a3742ddae6261eb4c1d24ed94e6c749 Talk
1
2
3
Declare @Index varchar(128)
...

C# Drop all Indexes in SQL Server

by GateKiller, October 07, 2008 10:48, 4 refactorings, tagged with sql, Index

The below is some code I re...

98c852e2d9b26249745ea92c72964d3f Talk
1
2
3
4
public static void Capitalize()
{
    TextInfo oTextInfo = CultureInfo.CurrentCulture.TextInfo;
...

C# Capitalize directory name w...

by Moonshield, October 02, 2008 01:31, No refactoring, tagged with C#, LINQ, Capitalize, Directory

I wrote a method to capital...

72f36daa501cf8f5bb861210edd9232d Talk
1
2
3
4
    public class Timer
    {

...

C# Timer Class

by McDole, September 25, 2008 06:06, 3 refactorings, tagged with C#

This is a quick timer class...

503dc458e66746c5ac681e7057d209dd Talk
1
2
3
Use Master

...

C# Backup All MS SQL Server Da...

by GateKiller, September 19, 2008 15:19, 2 refactorings, tagged with sql

I've recently blogged about...

98c852e2d9b26249745ea92c72964d3f Talk
1
2
3
4
public static string ToRelativeDate(DateTime input)
{
    string suffix = "ago";
...

C# Twitter-esque Relative Dates

by Foxx, September 16, 2008 00:41, 3 refactorings, tagged with date C#

Given an input date, this m...

Ed581b36edb9fa8f4c46e7ebef6b2fc5 Talk
1
2
3
4
    class RelativeDateParser
    {
        
...

C# Parse Relative Date

by Larsenal, September 11, 2008 00:33, 1 refactoring, tagged with date time, parser

I'd like to build up someth...

61fcda6377c3941f33130902c15ba27e Talk
1
2
3
4
private string getMD5String(string PlainText)
{
   System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();
...

C# Cryptography with MD5

by acidmind, September 01, 2008 13:19, 3 refactorings, tagged with MD5;C#;

This is a simple example of...

78f078ded4ae388e490c240c038c7f28 Talk
1
2
3
4
using System.Security.Cryptography;

public class CryptographyRSA()
...

C# Cryptography with RSA and B...

by acidmind, August 29, 2008 12:20, 2 refactorings, tagged with Cryptography;RSA;Base64

This is a simple example of...

78f078ded4ae388e490c240c038c7f28 Talk
1
2
3
4
namespace Utilities
{
    using System;
...

C# StringExt.cs (String Extens...

by snafu918, August 06, 2008 16:46, 6 refactorings, tagged with C#, Extension, string, coldfusion

Ok take it easy on me, I ju...

95fd293467e8e89e44701d09eead51d4 Talk
1
2
3
4
private static Regex _namedtags = new Regex
    (@"</?(?<tagname>\w+)[^>]*(\s|$|>)",
    RegexOptions.Singleline | RegexOptions.ExplicitCapture);
...

C# Balance HTML Tags

by Jeff Atwood, July 11, 2008 08:40, 25 refactorings, tagged with html, balance, tags, unbalanced

For the subset of HTML tags...

51d623f33f8b83095db84ff35e15dbe8 Talk
1
2
3
4
class Item
{
...

C# Traversing a List and colle...

by arjang.assadi.myopenid.com, July 09, 2008 04:48, 6 refactorings, tagged with generics

I like to to traverse a lis...

68225315200a9e0f0b949b7aec9b3b11 Talk
1
2
3
Declare @Name varchar(128)
Declare @Cursor Cursor
...

C# Cache SQL Server Views

by GateKiller, July 02, 2008 15:07, 7 refactorings, tagged with sql query unoptimized

Question: Is there anyway t...

98c852e2d9b26249745ea92c72964d3f Talk
1
2
3
4
namespace DataSetTableAdapters {

    partial class MyTableAdapter {
...

C# TableAdapter and CommandTim...

by Auron, July 02, 2008 10:19, 8 refactorings, tagged with tableadapter, commandtimeout, dataset, ado, C#, .net

As TableAdapters are are au...

C2953d47b6de83f3217b48c3584fab1c Talk
1
2
3
4
public static List<T> MergeListCollections<T>(List<T> firstList, List<T> secondList)
{
    List<T> mergedList = new List<T>();
...

C# Merge generic lists

by nkirkes.myopenid.com, June 30, 2008 18:42, 5 refactorings, tagged with C#, List<T>, generics

Toying with some utility me...

9661a8802c6d6f7e876c6fc7bae6721b Talk
1
2
3
4
// ***** Encryption and Decryption ***** //

byte[] Key(string sText) {
...

C# Encryption and Decryption

by GateKiller, June 20, 2008 14:00, 2 refactorings, tagged with Encrypt, Decrypt, C#

This is my first attempt at...

98c852e2d9b26249745ea92c72964d3f Talk
1
2
3
4
private static Regex _tags = new Regex("<[^>]*(>|$)", RegexOptions.Singleline | RegexOptions.ExplicitCapture | RegexOptions.Compiled);
private static Regex _whitelist = new Regex(@"
    ^</?(a|b(lockquote)?|code|em|h(1|2|3)|i|li|ol|p(re)?|s(ub|up|trong|trike)?|ul)>$
...

C# Sanitize HTML

by Jeff Atwood, June 20, 2008 08:24, 54 refactorings, tagged with xss, sanitize, html

Takes a provided HTML strin...

51d623f33f8b83095db84ff35e15dbe8 Talk
1
2
3
4
using System;
using System.Collections.Generic;
using System.Linq;
...

C# Pointers in C#

by Andre Steenveld, May 06, 2008 10:39, 1 refactoring, tagged with Unsafe, C#, pointers, unmanaged

I am trying to work out how...

Avatar Talk
1
2
3
4
void CopySourceTables(List<TableNameResult> tables, int id)
{
    // Execute the "Copy" Command on the Server for Each Table.
...

C# Common StProc Code

by robzyc, April 02, 2008 12:53, 12 refactorings, tagged with C#

Hi guys, following my previ...

C290d3851c7837081d05b3491cbc331b Talk