Welcome To Snipplr


Everyone's Recent C# Snippets



1 ... 4 5 6 7 8 ... 16
This is about the simplest way I've found. See [this](http://stackoverflow.com/questions/1092463/getting-the-mac-address-of-the-remote-host) and [this](http://stackoverflow.com/questions/1092379/want-to-get-mac-address-of-remote-pc/1092392#1092392) a...
0 4789 posted 14 years ago by pckujawa
only works in async. events. Ending in "ing"
0 1047 posted 14 years ago by nickaranz
[Serializable] [XmlRoot("items")] public class ItemCollection : XmlSerializableCollection<Item> { }
0 800 posted 14 years ago by aelesbao
Sets the keep-alive interval for the socket.
0 1607 posted 14 years ago by aelesbao
Ever wanted a method that can truncate a string, but only on a word boundary? This method works like Substring() but doesn't snip a string in the middle of a word, i.e. it only truncates the string on a word boundary. Useful for producing a summary f...
1 1773 posted 14 years ago by stewartrae
.net 3.0+, To create stability in your code, you must check all inputs into a method to make sure they are valid . Often people overlook this step because of laziness, or because they aren't convinced that exceptions and assertions are actually in pl...
0 1124 posted 14 years ago by bryanlyman
A simple C# function to take a standard DateTime and convert it to a pretty string saying how many seconds/minutes/days/weeks/months ago the date was, it doesn't return an actual date, but that wouldn't be hard to change the month/week/day section to...
2 1131 posted 14 years ago by Maelstrom
This snippet is "extension method" for IDataReader. You can use this snippet below ; I assume you have datareader like that SqlDataReader dataReader = command.ExecuteReader(); if (dataReader.IsColumnExists("columnName")) { //do something...
0 1672 posted 14 years ago by emregulcan
Use this in the ApplicationModule.js file.
0 815 posted 14 years ago by garnold
Returns the username (domain\username) of the user that is currently logged in sharepoint. Can be used inside features / custom pages
0 1183 posted 14 years ago by dimian12
Steps to add custom properties to web part
0 937 posted 14 years ago by nickaranz
0 776 posted 14 years ago by cadnet
my take on fizzbuzz written in C#.Net - Razor
0 908 posted 14 years ago by rwczippy
Snip it if you keep forgetting how its done.
1 1103 posted 14 years ago by fengelz
Not that theres anything new to this. In fact its very old fashioned, but If you like me forget how its done; snip it.
0 1046 posted 14 years ago by fengelz
0 769 posted 14 years ago by garnold
Will return the host name that the site is running on. Example: `http://mysite.com` or `http://myspecialsite.com:102`
0 1387 posted 14 years ago by jasonseney
You need to register this at the top of the page (see code below). Remember you can do this on a layout page as well, instead of the master page. Then place the PublishingWebControls:EditModePane tag inline (see below). The ID can be anything...
0 785 posted 14 years ago by rumremix
it ignores commas in a csv that are in string quotes
0 968 posted 14 years ago by Krummelz
use this if you want to make a binary use an older version of a dependent binery
1 902 posted 14 years ago by samwa
This is far from ground breaking but I forget it all the time so thought this might be a useful place to keep a reference of it
0 1122 posted 14 years ago by AndewAllison
0 819 posted 14 years ago by garnold
The only way i know to create a normal "fire property changed" method that is still efficient yet strongly typed. The other common pattern uses run time checking and uses the TyepDescriptor for the current type to check for property existence - a muc...
0 703 posted 14 years ago by nimast
0 756 posted 14 years ago by tonatiuh
0 931 posted 14 years ago by tonatiuh
1 ... 4 5 6 7 8 ... 16