C Programming Tutorials and advice
CProgrammingTrends News Archives About Us Feedback

Recent Articles


Validating Strong Passwords In C# And ASP.NET
It's always a good idea to have a password policy when creating new applications. A password policy can vary from project to project, but the important part is just to have one to begin with. It is very difficult to implement later in the process and then change all the...

Retrieve Subdomain From A URL In C#
I had to come up with a method that retrieved the subdomain from the current web request on an ASP.NET website. I thought that the System.Uri class contained that information in an easy retrievable way, but no.

Working With Weeks In C# (Not That Obvious)
For some reason, Microsoft didn't add a Week property to the DateTime class. I never could figure out why. Instead they gave us the System.Globalization namespace, filled with date related functionality like the different...

Creating Safe Events In C#
Whenever you write class libraries, custom control or just about anything else, you probably raise a lot of home made events. That's a simple thing to do, but tedious to write over and over again. That's why I always use...

Assigining a TypeConverter to a Class you Don't Own
I ran into problems with the XNA Beta1, where by I had a class that had a Vector2 struct in. The problem with the XNA Vector2 struct is that there is no TypeConverter for it at the moment. This means that there is no support...


01.04.07


C#: Realtime Currency Exchange Class


By Mads Kristensen

Soon, I'm facing a new project where the need for up-to-date currency exchanges is crucial.

This is not the first time I've done this, but I wanted to make a reusable, self-maintainable class so I don't have to do it again.

The European Central Bank (ECB) provides the currency exchange rates on a daily basis in XML format, so all there needs to be done, is to wrap the XML file into a generic dictionary for easy use. With that in mind, here are the rules of the Currency class:

• Use XML file from ECB

• Update the currencies daily

• Must still function if the ECB has downtime

• Must be self maintained

• Must be plug 'n play. Only CLR classes can be used.

In order to make the class self maintained it uses a System.Timers.Timer to check the ECB website once an hour for updates. As soon as it finds an update, the XML file is being downloaded and parsed. This is the Download method which runs once an hour.

Low Rate eCommerce & Retail Plans



Continue reading this article.

About the Author:
Mads Kristensen currently works as a Senior Developer at Traceworks located in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in 2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and web services in his daily work as well. A true .NET developer with great passion for the simple solution.

About CProgrammingTrends
A collection of articles and tutorials designed to help C and C variant programmers in their programming work. C Programming Tutorials and advice

CProgrammingTrends is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com ITmanagmentNews.com


-- CProgrammingTrends is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2007 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal


archives | advertising info | news headlines | free newsletters | comments/feedback | submit article




CProgrammingTrends Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact