With a simple structure you and using LINQ (System.Linq) you can solve this problem as follows:
Create a structure to store your groups
public class NaturezaOperacao
{
    public int NatOper { get; set; }
    public List<Produto> Produtos { get; set; }
    public NaturezaOperacao()
    {
        //Inicialiando a lista para evitar problemas de null reference;
        Produtos = new List<Produto>();
    }
}
And we will call your input object as Product and represent it as follows.
public class Produto
{
    public int Prod { get; set; }
    public int NatOper { get; set; }
}
Now comes the Linq and a foreach() for you to group the products by NatOper
//Sua lista de entrada
var produtosInput = new List<Produto>
{
    new Produto { Prod = 2345, NatOper = 5402 },
    new Produto { Prod = 2343, NatOper = 5402 },
    new Produto { Prod = 46123, NatOper = 5404 }
};
var gruposNaturezaOperacao = new List<NaturezaOperacao>();
//Selecionando as NatOper distintas que que existem na entrada
foreach (var natureza in produtosInput.Select(n => n.NatOper).Distinct())
{
    gruposNaturezaOperacao.Add(new NaturezaOperacao
    {
        NatOper = natureza,
        Produtos = produtosInput.Where(p => p.NatOper == natureza).ToList()
    });
}
The final result for gruposNaturezaOperacao, represented in JSON for easy viewing, will be:
[
   {
      "NatOper":5402,
      "Produtos":[
         {
            "Prod":2345,
            "NatOper":5402
         },
         {
            "Prod":2343,
            "NatOper":5402
         }
      ]
   },
   {
      "NatOper":5404,
      "Produtos":[
         {
            "Prod":46123,
            "NatOper":5404
         }
      ]
   }
]
							
							
						 
If you have a code?
– novic
@Virgilionovic, I don’t have it. This is something new to implement and I still don’t know how to do.
– pnet
You want a generic answer then?
– novic
@Virgilionovic, that’s right
– pnet
One could say in your question where the data comes from and why of the foreach
– novic
The foreach is for an Insert per product. The data comes from a proc through a service. Dude I’m lost here.
– pnet
And what do you mean by group?
– Leandro Angelo