如何在Namespace.Namespace.Namespace之间剪切变量? [英] How can I shear a variable between Namespace.Namespace.Namespace?
本文介绍了如何在Namespace.Namespace.Namespace之间剪切变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有3个名称空间
namespace-> namespace-> namespace
UNIVERSE-> PLANETS-> EARTH
我想要在3个命名空间中共享一个变量(字符串人),我知道我可以编写类或接口但是我搜索新的解决方案吗?
i have 3 namespace
namespace->namespace->namespace
UNIVERSE->PLANETS->EARTH
I want to SHARE a variable (string human) in 3 namespace,i know i can write class or interface but i search new solution?
var NAMESPACE={
UNIVERSE:{
PLANETS:{
EARTH:{
HUMANBEINGS:{
var man = function(){
alert('I am man.')
}
var woman = function(){
alert('I am woman.')
}
}
}
}
}
}
找到弹出命名空间中所有var的方法是否可行?
find way to eject all var in namespace is possible or not?
推荐答案
这根本没有意义。
什么是剪切变量?我已经编写了35年的代码而且从未听说过这个术语。
现在,如果你要用某个东西分享一个变量,那就是另一个故事了。 br />
我也从来没有见过像那样编写的C#代码,所以它对我来说没有任何意义。
This makes no sense at all.
What is "shear" a variable? I've been writing code for 35 years and never heard of the term.
Now, if you were to SHARE a variable with something, that's a different story.
I have also never seen C# code written like that, so it currently means nothing to me.
我想首先关注你令人困惑的命名空间和类名。话虽这么说,只需在一个命名空间中创建一个静态变量并引用它。 IE Humanbeings.gender,或类似Humanbeings.GetGender()的静态方法;
I think first off you are confusing namespace and class names. That being said, just make a static variable in one namespace and reference it. IE Humanbeings.gender, or a static method like Humanbeings.GetGender();
这篇关于如何在Namespace.Namespace.Namespace之间剪切变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文