Quantcast
Channel: Martijn's C# Programming Blog » Beginner
Browsing latest articles
Browse All 10 View Live

Image may be NSFW.
Clik here to view.

Formatting Strings in C# with String.Format

String.Format is a very powerful method but the documentation at MSDN is quite wordy and spreads the details over many pages. For this post I have made quick reference to its many specifiers and for...

View Article



Image may be NSFW.
Clik here to view.

Using String.Split and String.Join to build a simple CSV reader and writer in C#

Whole programming languages have been designed (*cough* perl) so that we can cut delimited strings into bits and string them back together. For this purpose C# provides the String.Split() and...

View Article

C# Anonymous types: the Basics

With the introduction of .NET 3.5 C# includes the “var” keyword to support anonymous types. One important motivation for this was to make code written with LINQ (Language-Integrated Query) easier to...

View Article

Manipulating Strings in C# – Finding all occurrences of a string within...

A common programming problem is to find the position of all copies of a string in another string. For finding the first copy the C# string method IndexOf is similar to the C strpos() function. It...

View Article

Manipulating Strings in C# -Replacing part of a string / Replacing all...

Very often you need to change part of a string, maybe just once, or many times over. Strings in .NET/C# are immutable we cannot actually change a string in-place. But we are able to work on copies. The...

View Article


C# Preprocessor Directives Explained

By using pre-processor directives you can exclude parts of your code from being seen by the compiler. Excluded from the assembly they are never seen at run-time. This is different from a regular if (x)...

View Article

Using the C# WebClient class to upload and download FTP files

Your C# program has just calculated the weekly sales report and you need to upload it to the company file server. The C# System.Net.Webclient class makes this quite trivial. The same for downloading a...

View Article

Simple class to submit (POST) a Web form from C#

Today I needed to automate posting some data to a web form from a C# program, and sure enough this is not at all that difficult. But surprisingly you need to call quite a large number of methods to get...

View Article


Image may be NSFW.
Clik here to view.

Using C# and .NET to send an e-mail through SMTP

Sending an e-mail is pretty old news by now so it should come as no surprise that .NET contains a significant SMTP mail client. One old programming truth still holds: All programs will expand to...

View Article


Image may be NSFW.
Clik here to view.

Safely cleaning HTML with strip_tags in C#

One of my favorites in the PHP libraries is the strip_tags function. Not only does it neatly remove HTML from an input it also allows you to specify which tags should stay. This is great if you are...

View Article
Browsing latest articles
Browse All 10 View Live




Latest Images