# get

@Nullable
abstract fun get(name: String): Any(source)

Returns the value for the registered property with the given name. When using an extra properties extension from Groovy, you can also get properties via Groovy's property syntax. All of the following lines of code are equivalent.

    project.ext { foo = "bar" }

    assert project.ext.get("foo") == "bar"
    assert project.ext.foo == "bar"
    assert project.ext["foo"] == "bar"

    assert project.foo == "bar"
    assert project["foo"] == "bar"

Content copied to clipboard
When using the first form, an UnknownPropertyException exception will be thrown if the extension does not have a property called "`foo`". When using the second forms (i.e. Groovy notation), Groovy's groovy.lang.MissingPropertyException will be thrown instead.

#### Return

The value for the property with the given name.

#### Parameters

name

The name of the property to get the value of

#### Throws

ExtraPropertiesExtension.UnknownPropertyException

if there is no property registered with the given name