Here's another alternative using STUFF and FOR XML PATH that does not require a parameter (I believe this is from an article from SSC. If I could have found the URL I would have included it in this post in order to give the appropriate credit.)
SELECT STUFF((SELECT ', ' + name
FROM @table
WHERE gender = 'M'
FOR XML PATH('')), 1, 2, '')