[Overview][Resource strings][Classes][Index] | Reference for unit 'resfactory' (#fcl-res)

# TResourceFactory.CreateResource

Creates a new resource

## Declaration

Source position: resfactory.pp line 46

`public class function TResourceFactory.CreateResource(`
`aType: TResourceDesc;`
`aName: TResourceDesc`
`):TAbstractResource;`

## Arguments

`aType` |  | The type of the resource to create
`aName` |  | The name of the resource to create

## Function result

A new resource

## Description

This class method creates a new resource of the class associated with the given type, and sets its name and type based on the values passed as parameters.

If no class matching the given type is found, the resource is created with TGenericResource class.

## See also

TResourceFactory |  | Factory class for resources
TResourceFactory.RegisterResourceClass |  | Registers a resource class
TGenericResource |  | Generic resource class