public INamedValueSet AsNVS(bool includeExtraProcessInfo = false, bool includeTrackedValues = false) { IEnumerable <INamedValue> main = new NamedValueSet() { { "pid", pid }, { "name", name }, }.MakeReadOnly(); NamedValueSet extra = NamedValueSet.Empty; if (includeExtraProcessInfo) { extra = new NamedValueSet() { { "basePriority", basePriority }, { "mmfPath", mainModuleFilePath }, }; if (mainModuleFileVersion != null) { extra.SetValue("mmfVersion", mainModuleFileVersion.ProductVersion); extra.SetValue("mmfCompany", mainModuleFileVersion.CompanyName); } } extra.MakeReadOnly(); IEnumerable <INamedValue> tracked = !includeTrackedValues ? NamedValueSet.Empty : trackedValues.AsNVS(); return(new NamedValueSet(main.Concat(extra).Concat(tracked)).MakeReadOnly()); }