C# Sample Code
-
Deep clone an object in .NET
by James Crowley
A simple code snippet that deep-copies an object by serializing and de-serializing using the BinaryFormatter
-
Making a .NET app run on Vista with Administrator priviledges
by James Crowley
If you're targeting Windows Vista and your application requires administrator priviledges (such as accessing the program files directory), then it will fail unless you include a manifest so Windows knows. Here's how.
-
Generate PDFs using C# and the free iTextSharp library
by James Crowley
Learn how to use the free iTextSharp library to load a PDF form, populate some dynamic fields, and then save out a flat PDF file.
-
Interacting with TinyPic from C#
by Fernando Sanchez
The following tutorial will demonstrate how to interact with http://tinypic.com, an image mirroring service, directly from a C# application using the WebRobot component.
-
Create PDF Files on fly in C#
by Salman Zafar
This sample code shows how to use the iText library to generate PDF files on the fly. The iText classes are very useful for people who need to generate read-only, platform independent documents containing text, lists, tables and images.
-
Developing your first Visual WebGui application
by Guy Peled
An introduction to Visual WebGui through a sample application.
-
Visual WebGui a unique approach to AJAX development
by Guy Peled
Visual WebGui is not just another AJAX framework but rather a different approach to web application development, specially designed to simplify building highly complex applications like Outlook Web Access (OWA). Visual WebGui makes it possible for developers to create applications that were previously developed only by the "big guys".
-
Sorting and Searching Using C# Lists
by Craig Murphy
The support for lists in C# 2.0 makes sorting and searching very easy. This code snippet demonstrates how to create a list of Person objects (with name and age attributes), sort by name, sort by age and search based on age.
-
The "Using" Statement in C#
by Xavier Larrea
The using statement in the c# language allows us to define an scope for an object lifetime. This statement obtains the resource specified, executes the statements and finally calls the Dispose() method of the object to clean it up.
-
Sending Authenticated Emails in .NET 2.0
by Xavier Larrea
Learn what's changed with .NET 2.0 and how to send out emails using an SMTP server that requires authentication.
-
Using Microsoft Agent in C#
by M M Harinath
Microsoft Agent is a new technology, which allows Programmer to create and use animated characters that can interact with end users. It also supports the Microsoft Speech API, which allows the character to speak with the user.
-
Checking Internet Availability using C#
by M M Harinath
While developing Internet applications, this is important to check whether the internet connection is available or not. This snippet will be useful to achieve the above mentioned task.
-
Precise .NET Server Content Caching
by Dimitrios Markatos
A simple demonstration of how to programatically use the caching facilities that ASP.NET offers.
-
Transactions made easy with .NET 2.0
by Xavier Larrea
One of the more significant improvement in .NET 2.0 is the transactions area. Now with a single line it becomes extremely easy to support transactional code blocks using the concept of “ambient” transaction thanks to TransactionScope in the System.Transactions namespace.
-
Applying XSL transformations to XML in .NET
by Krishnan
A simple demonstration of how to apply an XSL transformation to an XML file and save the output using .NET
-
Using ASHX files to retrieve DB images
by Harry Pierson
Learn how to use the little-known Http Handler functionality of ASP.NET to serve images from a database.
-
IP2Location Geolocation .NET Component in VB.NET
by IP2Location Inc
IP2Location .NET component that translates IP address to country, city, region, latitude, longitude, ZIP code, ISP and domain name. Developers use this component for projects related to: 1. Display native language and currency; 2. Redirect based on country; 3. Digital rights management; 4. Prevent password sharing and abuse of service; 5. Reduce credit card fraud; 6. Web log stats and analysis;
-
Generate an Image of a Web Page
by Alan Dean
Demonstrates how to fetch images and thumbnails of web pages using a hidden web browser control.
-
Reading Binary Data in C#
by Jon Skeet
How to read binary data from a file in C# - the right way!
-
Using the Credential Management API
by Alan Dean
Following secure development best practice, an application should obtain and store user credentials securely. Microsoft has provided a means to accomplish this on the desktop: the unmanaged Credential Management API, which exposes the capability to provide a standard login experience for the user which is also secure. This code demonstrates how to create a generic dialog implementation using this API.