# withConvention

inline fun <ConventionType : Any, ReturnType> Any. withConvention(conventionType: KClass<ConventionType>, function: ConventionType.() -> ReturnType): ReturnType(source)

### Deprecated

The concept of conventions is deprecated. Use extensions instead.

Evaluates the given function against the convention plugin of the given conventionType.

#### Return

the value returned by the given function.

#### Parameters

conventionType

the type of the convention to be located.

function

function to be evaluated.

#### See also

Convention.getPlugin

#### Throws

IllegalStateException

When the receiver does not support convention plugins, when there is no convention plugin of the given type, or when there are multiple such plugins.