[英]#define to resolve namespace clashes
I have several WCF services that share classes but because of the way WCF works, these classes are all seen as new and different classes. 我有几个共享类的WCF服务,但是由于WCF的工作方式,这些类都被视为新的类。
Question: Is there a way to use C#'s #define to nicely resolve the clashes in a more readable way? 问题:是否可以使用C#的#define以更易读的方式很好地解决冲突?
Can I do something like 我可以做类似的事情吗
#define Dog global::My_Project.DogServiceReference.Dog
So that I can then do 这样我就可以做
List <Dog> dogs = ...
instead of 代替
List<global::My_Project.DogServiceReference.Dog>
@Chris Dunaway wrote: @克里斯·邓纳维(Chris Dunaway)写道:
Will a using alias work for this"
using GlobalDog = global::My_Project.DogServiceReference.Dog
and then useList<GlobalDog> dogs = ...
使用别名将为此工作
List<GlobalDog> dogs = ...
”using GlobalDog = global::My_Project.DogServiceReference.Dog
,然后使用List<GlobalDog> dogs = ...
I haven't tried this.我没有尝试过。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.