That code is using LINQ, which by default is not in 2.0 .Net framework
EDIT
string registryKeyPath;
string[] serviceNames = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\").GetSubKeyNames();
foreach (string serviceName in serviceNames)
{
if (serviceName.StartsWith(editedServiceName)
{
registryKeyPath = @"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\" + serviceName;
break;
}
}