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 3919 posted 12 years ago by pckujawa
only works in async. events. Ending in "ing"
0 613 posted 12 years ago by nickaranz
[Serializable] [XmlRoot("items")] public class ItemCollection : XmlSerializableCollection<Item> { }
0 438 posted 12 years ago by aelesbao
Sets the keep-alive interval for the socket.
0 1121 posted 12 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 1004 posted 12 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 683 posted 12 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 680 posted 12 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 1007 posted 12 years ago by emregulcan
Use this in the ApplicationModule.js file.
0 476 posted 12 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 794 posted 12 years ago by dimian12
Steps to add custom properties to web part
0 547 posted 12 years ago by nickaranz
0 474 posted 13 years ago by cadnet
my take on fizzbuzz written in C#.Net - Razor
0 545 posted 13 years ago by rwczippy
Snip it if you keep forgetting how its done.
1 675 posted 13 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 660 posted 13 years ago by fengelz
0 445 posted 13 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 908 posted 13 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 460 posted 13 years ago by rumremix
it ignores commas in a csv that are in string quotes
0 608 posted 13 years ago by Krummelz
use this if you want to make a binary use an older version of a dependent binery
1 530 posted 13 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 685 posted 13 years ago by AndewAllison
0 492 posted 13 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 419 posted 13 years ago by nimast
0 440 posted 13 years ago by tonatiuh
0 579 posted 13 years ago by tonatiuh
1 ... 4 5 6 7 8 ... 16