开发者

What is the best naming conventions for XAML namespaces?

开发者 https://www.devze.com 2023-03-22 16:20 出处:网络
Which type of naming is better to use in XAML: xmlns:inventoryControls=\"clr-namespace:Inventory.Components.Controls;assembly=Inventory.Components\"

Which type of naming is better to use in XAML:

  1. xmlns:inventoryControls="clr-namespace:Inventory.Components.Controls;assembly=Inventory.Components"
    

    Then use it like this:

    <inventoryControls:AdvancedTextBox/>
    
  2. xmlns:ic="clr-namespace:Inven开发者_运维知识库tory.Components.Controls;assembly=Inventory.Components"
    

    Then use it like this:

    <ic:AdvancedTextBox/>
    

If you recommend the second way please consider about duplicates in first letter of the namespaces for example may be I wana refere to "Inventory.Components" namespace.

This is the second approach problem example:

xmlns:inventoryControls="clr-namespace:Inventory.Components.Controls;assembly=Inventory.Components"
xmlns:inventoryComponents="clr-namespace:Inventory.Components;assembly=Inventory.Components"


Write either what you like better or what your team agrees is the better option.

My personal opinion is to use some shortening: In XAML, you have to always specify the namespace and writing the whole name every time causes long lines and doesn't help readability much.

But that doesn't mean you have to shorten to just the initials, especially if that causes conflicts. In your cause I would use iCtrls and iComps or iControls and iComponents.

0

精彩评论

暂无评论...
验证码 换一张
取 消