Click here to Skip to main content
15,883,891 members
Articles / Programming Languages / C#

NPerf, A Performance Benchmark Framework for .NET

Rate me:
Please Sign up or sign in to vote.
4.92/5 (44 votes)
25 Jan 20044 min read 231.1K   705   139  
NPerf is a framework for benchmarking classes and methods, that tastes like NUnit.
using System;
using System.Collections;

namespace NPerf.Cons.Collections
{
	/// <summary>
	/// Summary description for ClParameterDictionary.
	/// </summary>
	public class ClParameterDictionary
	{
		private StringClParameterDictionary shortParameters;
		private StringClParameterDictionary parameters;

		public ClParameterDictionary()
		{
			this.shortParameters = new StringClParameterDictionary();
			this.parameters = new StringClParameterDictionary();
		}

		public void Add(ClParameter p)
		{
			if (p==null)
				throw new ArgumentNullException("p");

			this.shortParameters.Add(p.ShortName,p);
			this.parameters.Add(p.Name,p);
		}

		public bool Contains(string key)
		{
			if (key==null)
					throw new ArgumentNullException("key");
			if (this.shortParameters.Contains(key))
				return true;
			return this.parameters.Contains(key);
		
		}

		public ClParameter this[string key]
		{
			get
			{
				if (key==null)
					throw new ArgumentNullException("key");
				if (this.shortParameters.Contains(key))
					return this.shortParameters[key];
				return this.parameters[key];
			}
		}

		public IDictionary ShortParameters
		{
			get
			{
				return this.shortParameters;
			}
		}

		public IDictionary Parameters
		{
			get
			{
				return this.parameters;
			}
		}
	}
}

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
Engineer
United States United States
Jonathan de Halleux is Civil Engineer in Applied Mathematics. He finished his PhD in 2004 in the rainy country of Belgium. After 2 years in the Common Language Runtime (i.e. .net), he is now working at Microsoft Research on Pex (http://research.microsoft.com/pex).

Comments and Discussions