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 3958 posted 12 years ago by pckujawa
only works in async. events. Ending in "ing"
0 637 posted 12 years ago by nickaranz
[Serializable] [XmlRoot("items")] public class ItemCollection : XmlSerializableCollection<Item> { }
0 454 posted 12 years ago by aelesbao
Sets the keep-alive interval for the socket.
0 1138 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 1025 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 696 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 704 posted 13 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 1037 posted 13 years ago by emregulcan
Use this in the ApplicationModule.js file.
0 492 posted 13 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 811 posted 13 years ago by dimian12
Steps to add custom properties to web part
0 565 posted 13 years ago by nickaranz
0 488 posted 13 years ago by cadnet
my take on fizzbuzz written in C#.Net - Razor
0 562 posted 13 years ago by rwczippy
Snip it if you keep forgetting how its done.
1 692 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 678 posted 13 years ago by fengelz
0 459 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 934 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 474 posted 13 years ago by rumremix
it ignores commas in a csv that are in string quotes
0 628 posted 13 years ago by Krummelz
use this if you want to make a binary use an older version of a dependent binery
1 549 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 702 posted 13 years ago by AndewAllison
0 506 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 427 posted 13 years ago by nimast
0 449 posted 13 years ago by tonatiuh
0 591 posted 13 years ago by tonatiuh
1 ... 4 5 6 7 8 ... 16