log4net SDK Reference |

# CompactRepositorySelector.CreateRepository Method (String, Type)

Create a new repository for the repository specified

[Visual Basic]
NotOverridable Overloads Public Function CreateRepository( _
ByVal repositoryName As String, _
ByVal repositoryType As Type _
) As ILoggerRepository _
Implements IRepositorySelector.CreateRepository
[C#]
public ILoggerRepository CreateRepository(
string repositoryName,
Type repositoryType
);

#### Parameters

repositoryName
  the repository to associate with the ILoggerRepository
repositoryType
  the type of repository to create, must implement ILoggerRepository. If this param is null then the default repository type is used.

#### Return Value

the repository created

#### Implements

IRepositorySelector.CreateRepository

#### Remarks

The ILoggerRepository created will be associated with the repository specified such that a call to GetRepository with the same repository specified will return the same repository instance.

If the named repository already exists an exception will be thrown.

If repositoryType is `null` then the default repository type specified to the constructor is used.

#### Exceptions

Exception Type | Condition
--- | ---
ArgumentNullException | throw if repositoryName is null
LogException | throw if the repositoryName already exists

#### See Also

CompactRepositorySelector Class | log4net.Core Namespace | CompactRepositorySelector.CreateRepository Overload List