T
CSharpTest.Net
NewFactory<T> Class
Members  Example  See Also  Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Interfaces Namespace : NewFactory<T> Class

Glossary Item Box

A factory that creates a new instance of an object each time Create() is called.

Syntax

Visual Basic (Declaration) 
Public Class NewFactory(Of T As {New}) 
   Implements IFactory(Of T) 
C# 
public class NewFactory<T> : IFactory<T>  
where T: new()

Type Parameters

T

Example

Library/Library.Test/TestFactories.cs

C#Copy Code
IFactory<TestObject> factory = new NewFactory<TestObject>();
Assert.IsFalse(ReferenceEquals(factory.Create(), factory.Create()));
VB.NETCopy Code
Dim factory As IFactory(Of TestObject) = New NewFactory(Of TestObject)()
Assert.IsFalse(ReferenceEquals(factory.Create(), factory.Create()))

Inheritance Hierarchy

System.Object
   CSharpTest.Net.Interfaces.NewFactory<T>

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys