\' – single quote, needed for character literals \" – double quote, needed for string literals \\ – backslash \0 – Unicode character 0 \a – Alert (character 7) \b – Backspace (character 8) \f – Form feed (character 12) \n – New line (character 10) \r – Carriage return (character 13) \t – Horizontal […]
Using clipboard with console applications
Clipboard is a windows object. If you want to use clipboard in your .NET framework console applications you must reference `System.Windows.Forms` and mark your main method with `STAThreadAttribute` attribute. Then you can use this class's methods e.g. Clipboard.SetText("some text to store in the clipboard"); Happy coding.
C# and VB.NET Code conversion
We, the developers sometimes need work with different languages for some projects. Especially if you are a .NET developer you will need a conversion tool to convert C# to VB.NET or VB.NET to C#. Here is a useful free tools for that need. C Sharp to VB.NET VB.NET to C Sharp You can check other […]
ToLowerInvariant() and ToUpperInvariant()
According to business rule all footballer name and surname must be capitalized and not longer than 8 chars length. Very simple to develop. We develop a wrapper method for this job. Seems working fine. Until this morning. Game masters of the http://icanfootball.com noticed that some player names violates this business rule. After my first debuging […]
How to use a method from class in other namespaces at .aspx pages
You can use using statement to inculde different namespaces in you code behind file. But still you can’t call methods from classes that live in other namespaces (Different from you page class namespace) from you content pages (.aspx). To make this work you must use import namespace directive after you page directive. This can be […]
How to clear all HttpContext Cache items?
“HttpContext.Current.Cache” has a metod to remove items one by one with their key names. If you want to remove all items from the cache you can use this little code snippet to achive this task: Happy coding… P.S.: This techique don’t effect the output cached pages.
JSON serialization and deserialization
JSON stands for Javascript Object Notation and this is the new lightweight (then XML) standart for transferring data from one point to another over the network. Here you can find a sample web page codebehind to see usage in C#. Static methods in ‘Functions‘ class Happy codings…
Timespan and Databases
When you are developing application you may need to store timespan database. (Assuming you are using Sql Server 2005) TimeSpan.TotalSeconds can be used to store. This returns a double. And maps to decimal data type of the sql server. For reverse action to get the time span you can use TimeSpan.FromSeconds method. This will give […]
How to use overloaded methods with ASP.NET Web Services
In .NET world it’s very common to write methods with same name but different parameters. This is called overloading. And if you use this technique wisely you can prevent some code repetation. But in the web services world of .net its not allowed by default. If you try you get an exception says : “Bla, […]
Problem with classes under App_Code folder in VS 2008
We are developing a new ASP.NET web application in Visual studio 2008. Last week we’ve decided to use HttpHandlers instead of some web pages. And as we used to do in Visual Studio 2005 web sites created an App_code folder after that we created new classes under that folder. Then we noticed that there is […]