Accessing PostProcessing Profile Settings from script URP error. 2020.2.7

(2020.2.7)(URP) I’m trying to make a dynamic depth of field effect. I have not imported any postprocessing assets from the package manager instead im using the global volume component on an empty game object. I have a volume profile linked to it which has a depth of field override which is set to the bokeh mode.
I made a new script and attached it to the camera

using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;

public class DepthOfField : MonoBehaviour
{
    DepthOfField comp;
    public Volume volume;
    void Start()
    {
        volume = gameObject.GetComponent<Volume>();
        volume.profile.TryGet<DepthOfField>(out comp);
    }
}

I get an error on

volume.profile.TryGet(out comp);
Which says
The type ‘DepthOfField’ cannot be used as a type parameter ‘T’ in the generic type or method ‘VolumeProfile.TryGet(out T)’. There is no implicit reference conversion from ‘DepthOfField’ to ‘UnityEngine.Rendering.VolumeComponent’.

Please Help!

Your class is named DepthOfField, so when you have local variable DepthOfField comp it is of type of the class it is in (DepthOfField) not of type UnityEngine.Rendering.Universal.DepthOfField


By the way, if anyone runs into this issue and this was not their cause, check to see if you have

using UnityEngine.Rendering.PostProcessing;

instead of

using UnityEngine.Rendering.Universal;

as that was my issue.