How to obtain generators of current environment

Unofficial Content
GxModel gxModel = m_kbserv.CurrentKB.WorkingModel.GetAs<GxModel>();
foreach (Artech.Genexus.Common.Entities.GxEnvironment env in gxModel.Environments)
{
      Artech.Genexus.Common.ModelParts.GeneratorDefinition generatorDefinition = Artech.Genexus.Common.ModelParts.ModelDefinitionsManager.GetGeneratorDefinition(env.Generator);
      string friendlyName = (generatorDefinition != null) ? generatorDefinition.FriendlyName : String.Empty;
      MessageBox.Show(friendlyName);
}