How to Remove Code Snippet using Find and Replace from Visual Studio with Regular Expression?

1

I'm having a C # application that we're trying to remove code snippets from.

One of the situations I have several If / else, where else does not make sense.

Type like this (as an example):

var entidades= db.Entidades.ToList();
if (!entidades.Where(w => w.ID == 1).Any())
{
     db.Entidades.Add(new Entidade{
         Id = 1,
         Existe = 1,
         Descricao = "Descricao"
     })
}
else 
{
     var entidade = entidades.Where(w => w.Id == 1).FirstOrDefault();
     entidade.Existe = 1;
     entidade.Descricao = "Descricao";
}

And this happens in several parts of the code, many of them.

So I would like to make a regular expression that removes all else.

    
asked by anonymous 30.08.2018 / 19:48

0 answers