Posts tagged “C#”

C# Replace method

The .Replace function is a string method used to replace characters or strings in a string with another character/string else. In its easiest form you would type something like: string.Replace(“replacethistext”,”withthistext”). Replace(string,string) String text = “My favourite colour is red.”; string correctedText = text.Replace(“red”, “green”); Console.WriteLine(text); Console.WriteLine(correctedText); Console.ReadKey(); Will result in: My favourite colour is red. [...]

Delegates

A delegate is a special type, where you can store a reference to a function. With delegates you change the way how you work, and somehow reverse it. Give it a function, and after that you give if the requested values for that function, and process it. Why? So you can assign an action (or [...]

Example Observer Application: Traffic Lights

This is the post where you have all been waiting for (I hope J), after reading the informative post what an Observer Pattern is. If you have no idea what an observer is, you better start reading my previous theoretical post about the Observer Pattern. First an overview of the application we are going to [...]

Add items to the Bulleted List Control (in the code file)

My next tutorial will be a really short one. But still I have spent a really long time to find what I was looking. Maybe because it was way to easy? I wanted to generate a BulletedList Web Control, in my code file. Inside a for-loop I wanted to add texts to my list. [ad#Adsense] [...]