Click here to Skip to main content
15,888,908 members
Articles / Programming Languages / C#

Using generics for calculations

Rate me:
Please Sign up or sign in to vote.
4.94/5 (140 votes)
11 Oct 20046 min read 515.7K   3.2K   214  
Performing calculations with generic types is not as easy it seems. This article shows how to do it.

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C# Express 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Arithmetic", "Arithmetic\Arithmetic.csproj", "{1C2129C6-6797-4892-8CEB-F2E99FDF1B03}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{1C2129C6-6797-4892-8CEB-F2E99FDF1B03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{1C2129C6-6797-4892-8CEB-F2E99FDF1B03}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{1C2129C6-6797-4892-8CEB-F2E99FDF1B03}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{1C2129C6-6797-4892-8CEB-F2E99FDF1B03}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Germany Germany
Rüdiger Klaehn works as freelance developer in the space industry. He is very interested in functional programming languages and hopes that .NET will lead to a more widespread adoption in the industry.

Comments and Discussions