Intellisense disappears when the list of arguments is large

Asked

Viewed 263 times

2

I’m using Visual Studio 2010 realized that when the list of parameters of the constructor is too large and does not fit on the screen Visual Studio no longer displays the list of parameters of the constructor. It is possible to configure it to display all without distinction?

inserir a descrição da imagem aqui

  • 2

    It is not good practice to use a very large list of arguments, your code is difficult to maintain. Have you considered passing a simpler object containing the properties you want to define in your constructor and then treating them in the constructor instead of a huge list of arguments? But it’s just a suggestion.

  • 1

    @Gabrielgartz but he is passing person data.. create another class just to pass... one person as parameter of the other? Even using DTO this gets weird :p

  • It’s been a while since I used dotnet. When I used I had the Resharper in my Visual Studio, it makes many improvements to the ide. Now I honestly don’t know if it solves your problem, you can take a look at at this link and see if there’s anything that solves.

3 answers

6


One solution would be to have a simple constructor and use the property initializer syntax that came with . NET 3.0

Your code would have an empty constructor with only one or two parameters and the other properties would be initialized separately during construction:

Pessoa pessoa = new Pessoa() {
    Nome = "nome",
    Sobrenome = "sobrenome",
    Idade = 33,
    Profissao = "programador",
    Salario = 10000.50,
    DtNascimento = new DateTime(12,12,1912)
};

This way Intellisense will complete all the bootable properties inside the keys and when it puts comma and the programmer can initialize as many as you want without having to pass null or empty string to those parameters that you do not have at the moment.

  • 2

    +1. If Pessoa is just a model with properties I agree that the constructor should not receive anything since no action is performed in the "setters".

  • 2

    But even if you have setters, the actions should be on the set of properties (which should have get and set properly validated and everything else). It can also be used in other situations.

3

Not at first. A possible solution would be to test whether Visual Studio 2013.

This is a type of error that if it was possible to solve without asking the user, they should do by default. The annoying thing about it is that it can cause false positives and find that the function only has that much parameter.

Something I saw was that it had plugins that seemed to improve Intellisense for other things and probably also should solve this, and maybe it will solve if this error is really annoying to you.

Source: a couple of years ago I also had to use Visual Studio 2010 and went through exactly at least problem and also by slowness in certain projects. At the time I thought it was a bug, and I remember searching but I didn’t find any reference to it.

  • Emerson one thing I noticed is that if you leave a bigger space (scroll the code) it will reappear.

0

An alternative would be to choose a different font or reduce its size through the menu

Ferramentas-> Opções-> Ambiente-> Fontes e cores

And choosing Dica de ferramenta do Editor on the menu drop-down to make the changes.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.