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 6059 posted 15 years ago by pckujawa
only works in async. events. Ending in "ing"
0 1750 posted 15 years ago by nickaranz
[Serializable] [XmlRoot("items")] public class ItemCollection : XmlSerializableCollection<Item> { }
0 1291 posted 15 years ago by aelesbao
Sets the keep-alive interval for the socket.
0 2428 posted 15 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 3122 posted 15 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 1827 posted 15 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 2036 posted 15 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 2505 posted 15 years ago by emregulcan
Use this in the ApplicationModule.js file.
0 1284 posted 15 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 1843 posted 15 years ago by dimian12
Steps to add custom properties to web part
0 1517 posted 15 years ago by nickaranz
0 1175 posted 15 years ago by cadnet
my take on fizzbuzz written in C#.Net - Razor
0 1400 posted 15 years ago by rwczippy
Snip it if you keep forgetting how its done.
1 1828 posted 15 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 1703 posted 15 years ago by fengelz
0 1239 posted 15 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 2172 posted 15 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 1301 posted 15 years ago by rumremix
it ignores commas in a csv that are in string quotes
0 1547 posted 15 years ago by Krummelz
use this if you want to make a binary use an older version of a dependent binery
1 1373 posted 15 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 1873 posted 15 years ago by AndewAllison
0 1265 posted 15 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 1110 posted 15 years ago by nimast
0 1209 posted 15 years ago by tonatiuh
0 1425 posted 15 years ago by tonatiuh
1 ... 4 5 6 7 8 ... 16