using System.Text.RegularExpressions;
This is some sample text.
foreach (var comment in FindComments(multiLineText))
Console.WriteLine(comment);
static string[] FindComments(string input)
Regex commentRegex = new Regex("^#.*$", RegexOptions.Multiline);
var matches = commentRegex.Matches(input);
string[] comments = new string[matches.Count];
for (int i = 0; i < matches.Count; i++)
comments[i] = matches[i].Value;