|
namespace htmlAttributes
{
using System;
/// <summary>
/// Summary description for AttributeFactory.
///
/// Used for creating an instance of a class that implements the IAttribute interface.
/// </summary>
public sealed class AttributeFactory
{
private AttributeFactory() {}
/// <summary>
/// Creates an instance of a custom attribute class based on the its type.
/// </summary>
/// <param name="type">Custom AttributeType.</param>
/// <returns>A new instance of a custom attribute implementation.</returns>
public static IAttribute GetAttribute(AttributeType type)
{
IAttribute attribute = null;
// Select based an the attribute type.
switch(type)
{
case AttributeType.Permission:
attribute = new PermissionAttribute();
break;
case AttributeType.TextStyle:
attribute = new TextStyleAttribute();
break;
}
return attribute;
}
}
}
|
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.
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
Javier is a consultant specializing in ASP.NET, system architecture, and training. He's also a MCSD .NET and a co-founder of the Iowa DotNET Users Group. Recently, Javier was awarded the
Visual Developer ASP.NET MVP award from Microsoft.
On his blog you can find posts on ASP.NET, architecture, design patterns, XML and just recently, Indigo. Javier enjoys giving back to the community by speaking at user groups, local/regional .NET events, being active in forums and by writing articles for Code Project.
In his spare time, Javier enjoys spending time with his wife, newborn son, two golden retrievers and writing about himself in third person.
Click here to read Javier's
blog.