Click here to Skip to main content
15,895,746 members
Articles / Programming Languages / C#

Refactoring to Adaptive Object Modeling: Strategy Pattern

Rate me:
Please Sign up or sign in to vote.
3.38/5 (13 votes)
20 Jun 20058 min read 91.1K   166   36  
Strategy methodology maintains that the operations and business rules or code flow of a class should be held as a collection of properties, as opposed to single method calls, which can be changed at runtime.
/* *******************************************************
 * This code created and or modified by Chris Lasater
 * http://www.geocities.com/lasaterconsult
 * Please refer all questions or comments to chris.lasater@gmail.com
 * 
 * You can use this code however you like, but please, make sure you give me 
 * credit on any publishings you do from this code. 
 * 
 * No warrenty is implied for any code here.
 * 
 *  ******************************************************* 
 */


using System;

namespace Strategy.Entity
{
	/// <summary>
	/// Summary description for EntityAttribute.
	/// </summary>
	public class EntityAttribute
	{
		private string _attributeName;
		private object _attributeObject;
		private Type _attributeType;
				
		public EntityAttribute(string name, object obj, Type type)
		{
			_attributeName = name;
			_attributeObject = obj;
			_attributeType = type;	
		}   
				
		public string Name
		{
			get{return _attributeName;}
			set{_attributeName = value;}					
		}
				
		public object Value
		{
			get{return _attributeObject;}
			set{_attributeObject = value;}					
		}
				
		public Type TypeOf
		{
			get{return _attributeType;}
			set{_attributeType = value;}					
		}
	}
}

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
United States United States
Christopher G. Lasater

I am also a published author, please check out my book:
ISBN: 1-59822-031-4
Title: Design Patterns
Author:Christopher G. Lasater
More from my web site
Amazon.com


Comments and Discussions