- 浏览: 14372 次
最新评论
ApplicationDomain.currentDomain的细节
- 博客分类:
- 技术杂绘
ApplicationDomain.currentDomain的细节
2010年12月24日
平时使用这个属性的时候,一般不会注意什么,直接无脑拿来用的。。。
今天作一些代码验证时,发现了一个问题:
trace(ApplicationDomain.currentDomain==ApplicationDomain.currentDomain)
直接这样判断居然是不相等的!
于是查找了下帮助,上面写着:
currentDomainpropertycurrentDomain:ApplicationDomain [read-only]
Language Version: ActionScript 3.0Runtime Versions: AIR 1.0 Flash Player 9, Flash Lite 4
Gets the current application domain in which your code is executing.
Implementation
public static function get currentDomain():ApplicationDomain
貌似看起来没啥帮助,直接理解基本上就是一个只读指针了,怎么会同样的东东不一致呢。
分析估计是一个工厂模式的实现,即每次会找到stage的所在,然后包装成一个新的ApplicationDomain返回。
这样用对于URLLoader使用loadercontext时略方便,以及在无法获得stage的情况下也能够正确得到applicationDomain。
但每次不一致有时还是很纠结
不过好在每个loaderinfo的applicationDomain是真正的只读指针,即下面这样用肯定是会相等的:
trace(stage.loaderInfo.applicationDomain==stage.loaderInfo.applicationDomain)
既然ApplicationDomain.currentDomain不能直接的得到stage的applicationDomain的直接引用,也不能判断多domain的情况的正确性对比,所以要用的话最好还是单独封装到一个另一个静态类中,如StageApplicationDomain.currentDomain,并且由stage初始化时简单赋值即可。。。
真不知道adobe咋想的,简单做成一个指针不就得了……
发表评论
-
javaIO浅析
2012-01-20 08:36 719javaIO浅析 2010年06月13日 什么是流: ... -
linux 进程通信――C语言实现
2012-01-20 08:36 838linux 进程通信――C语言实现 2010年10月15日 ... -
Dot NET:嵌入式开发平台(图)
2012-01-20 08:36 591Dot NET:嵌入式开发平台(图) 2010年08月11日 ... -
Mnesia 一个用于电信应用系统的健壮的分布式DBMS
2012-01-20 08:36 609Mnesia 一个用于电信应用系统的健壮的分布式DBMS ... -
uboot的配置问题对\include\configs\[boardname].h的修改
2012-01-20 08:35 1773uboot的配置问题对\include\configs\[bo ... -
ApplicationDomain
2012-01-19 13:42 638ApplicationDomain 2010年08月01日 ... -
flex3控件_ModuleLoader
2012-01-19 13:42 546flex3控件_ModuleLoader 2011年07月0 ... -
Flex-LoaderContext applicationDomain 属性详解
2012-01-19 13:42 938Flex-LoaderContext applicationD ... -
修复工具类
2012-01-19 13:41 657修复工具类 2011年05月08日 ... -
LINUX 常用基本指令
2012-01-17 03:31 613LINUX 常用基本指令 2011年08月05日 lin ... -
计算机基础应用》理论题1
2012-01-17 03:31 863计算机基础应用》理论 ... -
学习光盘刻录必备基础知识
2012-01-17 03:31 776学习光盘刻录必备基础 ... -
Ghost命令全解析 百度搜集
2012-01-17 03:31 636Ghost命令全解析 百度搜集 2010年06月21日 ... -
衣食住行皆史
2012-01-16 02:06 653衣食住行皆史 2010年04 ... -
人的衣食住行
2012-01-16 02:06 748人的衣食住行 2009年11月28日 衣食住行 【词目 ... -
走近古人的生活 衣食住行
2012-01-16 02:06 956走近古人的生活 衣食住行 2009年12月19日 教材分 ... -
中国古代衣食住行 9
2012-01-16 02:06 663中国古代衣食住行 9 2009年09月27日 陈设和起居 ... -
中国古代衣食住行 6
2012-01-16 02:06 511中国古代衣食住行 6 2009年09月27日 ...
相关推荐
关于AppDomain编程的全面资料,适合中高级技术人员阅读
context.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain); context.applicationDomain = ApplicationDomain.currentDomain; context.applicationDomain = new ApplicationDomain(); ...
System.AppDomain.CurrentDomain.BaseDirectory // 获取模块的完整路径。 System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName // 获取和设置当前目录(该进程从中启动的目录)的完全限定目录。 ...
获取当前目录可以使用 代码如下:appdomain.currentdomain.basedirectory 获取当前目录的上级目录 代码如下:path.getfullpath(“..”) 具体代码如下: 代码如下:using system; using system.collections.generic; ...
打开数据库连接 string dataDir = AppDomain.CurrentDomain.BaseDirectory; if (dataDir.EndsWith(@"\bin\Debug\") || dataDir.EndsWith(@"\bin\Release\")) { dataDir = System.IO.Directory.GetParent(dataDir...
//可获得当前执行的exe的文件名。 string str1 =Process.GetCurrentProcess().MainModule.FileName;// 获取和设置当前目录(即该进程从中启动...string str7=AppDomain.CurrentDomain.SetupInformation.ApplicationBase
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);//添加代码 InitializeComponent(); JObject obj = new JObject(); } //添加代码 System.Reflection....
log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "log4net.config")); HostFactory.Run(x => { x.UseLog4Net(); x.Service(); x.SetDescription(...
asp.net using System;... file.SaveAs(Path.Combine(AppDomain.CurrentDomain.BaseDirectory+@"ChatTemp\" , file.FileName)); } } public bool IsReusable { get { return true; } } }
MVC+ICOAutoFac+EF+三层+VS2013 ICOAutoFac+构造函数注入,单个类注入,一次所有类注入,接口注入 简单例子仅供学习,数据库DBscript.sql,... var assemblys = AppDomain.CurrentDomain.GetAssemblies().ToList();
这里建立了一个有关异常处理的对话框类,来实现异常的捕捉。通过使用ThreadException, App.CurrentDomain.UnhandledException捕捉程序里不可预知的异常,可以帮助开发者方便的找到发生异常的位置。
inter.StartOPCSvr (System.AppDomain .CurrentDomain .BaseDirectory +"Test.exe"); //暂停当前服务 inter.Suspend (); //重新启动服务 inter.Resume (); //停止当前服务 inter.CloseOPCSvr(); //查看当前TAG...
StreamReader objFile = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + @"\PictureLog.txt"); txtLog.Text = objFile.ReadToEnd(); objFile.Close(); objFile.Dispose(); } catch { txtLog....
inter.StartOPCSvr (System.AppDomain .CurrentDomain .BaseDirectory +"Test.exe"); //暂停当前服务 inter.Suspend (); //重新启动服务 inter.Resume (); //停止当前服务 inter.CloseOPCSvr(); //查看当前TAG...
private FileAgileLogger logger = new FileAgileLogger(AppDomain.CurrentDomain.BaseDirectory "UpdateLog.txt"); private IRapidPassiveEngine rapidPassiveEngine; private UpdateConfiguration update...
源码概要描述 :2个Excel 作为主表,利用第三个Excel作为模板,生成新的...System.AppDomain.CurrentDomain.BaseDirectory.Replace(@"bin\Debug\", @"Template\excel模板.xlsx") 这句代码就是为了获得Excel模板所在路径
pro.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + "ffmpeg.exe"; pro.StartInfo.Arguments = " -i " + fileName; pro.Start(); System.IO.StreamReader errorreader = pro.StandardError; ...
inter.StartOPCSvr (System.AppDomain .CurrentDomain .BaseDirectory +"Test.exe"); //暂停当前服务 inter.Suspend (); //重新启动服务 inter.Resume (); //停止当前服务 inter.CloseOPCSvr(); //查看当前TAG...
, AppDomain.CurrentDomain.BaseDirectory + "Download\\" + filelist[i].Name.ToString()); } --上传文件方法体 string sourcePath = AppDomain.CurrentDomain.BaseDirectory + "ABC\\"; FTPSClient client = ...