Code
Is it good practice to use namespace like a variable???Code
using CommonEntities = HEPL.Common.UIModel.Entities;OR
Code
using HEPL.Common.UIModel.Entities;Code
Code
which one is good practice in above code?Is it good practice to use namespace like a variable???using CommonEntities = HEPL.Common.UIModel.Entities;using HEPL.Common.UIModel.Entities;which one is good practice in above code?Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Pradeep ShetRank #595 · 4K reputationPosted Jul 28, 2014, 4:02 AM EDT
Both are same things but according to me,
using HEPL.Common.UIModel.Entities; is a good practice but if you want to use classes of specific namespace and for better readability like without doing mouseover on class you want to know the namespace to which any particular class belong then go for namespace like a variable. Hope this helps you, if yes mark it answered.jitendra kumar24 reputationPosted Jul 28, 2014, 4:02 AM EDT
using HEPL.Common.UIModel.Entities; This will be better approach. Because respective this namespace, classes, methods, property can be accessed directly in the code. If it to assign to using variable, then it takes the separate place in memory. It causes the performance issue of the application.VulpesRank #55 · 29.2K reputationPosted Jul 28, 2014, 5:40 AM EDT
using CommonEntities = HEPL.Common.UIModel.Entities;
is if that particular namespace contains a type (SomeClass say) whose name clashes with a type in another namespace you're importing or which you've written yourself.
Instead of having to write out HEPL.Common.UIModel.Entities.SomeClass you can then abbreviate it to CommonEntities.SomeClass to distinguish it from the other SomeClass in your project.