Castle.MonoRail.ActiveRecordSupport.ARDataBinder.CreateContainer C# (CSharp) Method

CreateContainer() private method

private CreateContainer ( Type type ) : object
type System.Type
return object
		private object CreateContainer(Type type)
		{
			if (type.IsGenericType)
			{
				if (type.GetGenericTypeDefinition() == typeof(ISet<>))
				{
					Type[] genericArgs = type.GetGenericArguments();
					Type genericType = typeof(HashedSet<>).MakeGenericType(genericArgs);
					return Activator.CreateInstance(genericType);
				}
				else if (type.GetGenericTypeDefinition() == typeof(IList<>))
				{
					Type[] genericArgs = type.GetGenericArguments();
					Type genericType = typeof(List<>).MakeGenericType(genericArgs);
					return Activator.CreateInstance(genericType);
				}
			}
			else
			{
				if (type == typeof(IList))
				{
					return new ArrayList();
				}
				else if (type == typeof(ISet))
				{
					return new HashedSet();
				}
			}
			return null;
		}