gpt4 book ai didi

c# - Visual Studio编译器错误和警告是否可以格式化?

转载 作者:行者123 更新时间:2023-12-02 11:05:49 27 4
gpt4 key购买 nike

具体来说,我正在寻求从通用类型中删除 namespace 。在我的情况下,这些对错误消息的值(value)很小,但是使错误很难破译。

例如,错误消息显示:

VendorName.LayerName1.FolderName1.ClassName1[VendorName.LayerName2.FolderName2.GenericType1, VendorName.LayerName2.FolderName2.GenericType2, VendorName.LayerName2.FolderName2.GenericType3].Property1 cannot implement VendorName.LayerName2.FolderName3.InterfaceName1[VendorName.LayerName2.FolderName2.GenericType1, VendorName.LayerName2.FolderName2.GenericType2, VendorName.LayerName2.FolderName2.GenericType3].Property1 because it does not have the matching return type System.Collections.Generic.Dictionary[VendorName.LayerName1.FolderName1.ClassName2[VendorName.LayerName2.FolderName2.GenericType1, VendorName.LayerName2.FolderName2.GenericType2, VendorName.LayerName2.FolderName2.GenericType3], VendorName.LayerName1.FolderName1.ClassName3[VendorName.LayerName2.FolderName2.GenericType1, VendorName.LayerName2.FolderName2.GenericType2, VendorName.LayerName2.FolderName2.GenericType3]]



如果没有 namespace ,它将更加清晰:

ClassName1[GenericType1, GenericType2, GenericType3].Property1 cannot implement InterfaceName1[GenericType1, GenericType2, GenericType3].Property1 because it does not have the matching return type Dictionary[ClassName2[GenericType1, GenericType2, GenericType3], ClassName3[GenericType1, GenericType2, GenericType3]]



请注意,我分别用[和]替换了“小于”和“大于”符号,因为这里的标记不允许我转义这些字符(至少我没有弄清楚)。

这样的事情可能吗?我正在使用VS2012。

最佳答案

据我所知,没有办法删除 namespace 。我想您要么必须使用短名称,要么使用已有的名称。

关于c# - Visual Studio编译器错误和警告是否可以格式化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12606888/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com