2012-09-25 13:09:59 +07:00
|
|
|
namespace Umbraco.Core
|
|
|
|
|
{
|
2015-01-16 15:47:44 +11:00
|
|
|
/// <summary>
|
2012-09-25 13:09:59 +07:00
|
|
|
/// Helper methods for Activation
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal static class ActivatorHelper
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates an instance of a type using that type's default constructor.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static T CreateInstance<T>() where T : class, new()
|
|
|
|
|
{
|
2015-01-16 15:47:44 +11:00
|
|
|
return new ActivatorServiceProvider().GetService(typeof (T)) as T;
|
2012-09-25 13:09:59 +07:00
|
|
|
}
|
2015-01-16 15:47:44 +11:00
|
|
|
|
|
|
|
|
|
2012-09-25 13:09:59 +07:00
|
|
|
}
|
|
|
|
|
}
|