.Net Full qualified name for variable type

Where I work, I often see this code:

public void Test(Models.User.UserInfo userInfo, Models.User.UserParameter param)
   { ... }

Personally, I prefer to see something like this:

public void Test(UserInfo userInfo, UserParameter param) { ... }

And import from above.

What do you think about this? What are the best practices? What are the pros and cons of both? How could I convince my teammates?

I think the second option is clearer.

+3
source share
3 answers

using, IMO. , Visual Studio. , - . , , , , , . - .

+5

, , , . using

. , .

0

, , , import using . : , .

, ( : , ), (.. , , Util, ) ( , , using). , (.. ). , , FQN, using.

If you use a name only once, you may be tempted to use FQN, but in my experience you will quickly find that you use several namespace names and refactor it to import the namespace into the header.

0
source

Source: https://habr.com/ru/post/1760155/


All Articles