Question: I'm not to sure this is possible, but I would like to try it out. 

This is the basics of what I am trying to do:

```
function somefunction () {
    $ListOfItems = (get-childitem c:\).name
    param (
        [validateset($ListOfItems)][string]$Moo
    )
}

```

I don't know if a variable can be used in validateset or not. It doesn't look so. If it can be, how would I go about doing this?

Answer: 
This is doable. You're after [`ValidateScript`](https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.core/about/about_functions_advanced_parameters#validatescript-validation-attribute)

```
Function somefunction () {
    param (
        [ValidateScript({$_ -in (Get-Childitem C:\).Name})] 
        [string]$Moo
    )
}

```

**Edit**  

The default error for `ValidateScript` is not user friendly:

```
PS C:\> somefunction -Moo thing

```

> 
> somefunction : Cannot validate argument on parameter 'Moo'. The "$\_
>  -in (Get-Childitem C:).Name" validation script for the argument with value "thing" did not return a result of True. Determine why the
>  validation script failed, and then try the command again.
> 
> 
> 

[This StackOverflow post goes over how to generate custom error messages](https://stackoverflow.com/questions/26100674/powershell-custom-error-from-parameters)
After reading the comments and completing researched based on the comments, I believe there is no simple way of doing what I want it to do.