惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News | PayPal Newsroom
IT之家
IT之家
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
大猫的无限游戏
大猫的无限游戏
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
LangChain Blog
S
SegmentFault 最新的问题
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Project Zero
Project Zero
P
Privacy & Cybersecurity Law Blog
V
Vulnerabilities – Threatpost
博客园 - 三生石上(FineUI控件)
Recorded Future
Recorded Future
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
CERT Recently Published Vulnerability Notes
宝玉的分享
宝玉的分享
aimingoo的专栏
aimingoo的专栏
T
Tor Project blog
T
The Exploit Database - CXSecurity.com
Schneier on Security
Schneier on Security
H
Help Net Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
M
MIT News - Artificial intelligence
W
WeLiveSecurity
P
Proofpoint News Feed
A
About on SuperTechFans
S
Securelist
I
InfoQ
G
Google Developers Blog
博客园 - 司徒正美
博客园 - 叶小钗
Latest news
Latest news
F
Fortinet All Blogs
G
GRAHAM CLULEY
腾讯CDC
Jina AI
Jina AI
S
Schneier on Security
I
Intezer
V
Visual Studio Blog
美团技术团队
V2EX - 技术
V2EX - 技术
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
Microsoft Security Blog
Microsoft Security Blog
Blog — PlanetScale
Blog — PlanetScale
P
Proofpoint News Feed
罗磊的独立博客
Y
Y Combinator Blog

博客园 - YFeng_Lee

webHttpBinding+wsHttpBinding+basicHttpBinding的区别 (转) AppDomain 详解(转) .net工具 InstallShield12 添加自定义对话框,并根据输入值修改对应的Config文件。 普通管理类程序开发之难度系数、层次之说法(转自csdn) 待阅读书目 C#开发Windows Service程序 创建一个windows service应用程序 Ext简介(转) Ext的组件结构分析(转) XML与数据库 分析模式 - 责任模式 NHibernate Cascades: the different between all, all-delete-orphans and save-update 企业开发框架NHibernate和Spring.Net简介-4 企业开发框架NHibernate和Spring.Net简介-3 企业开发框架NHibernate和Spring.Net简介-2 企业开发框架NHibernate和Spring.Net简介-1 Nhibernate学习之many-to-many篇(转 明了篇) Nhibernate学习起步之many-to-one篇(转 明了篇)
AppDomain对于静态对象的独享引用
YFeng_Lee · 2016-12-27 · via 博客园 - YFeng_Lee

AppDomain可以理解为一个独立的沙箱,当有独立的第静态对象在appDomain中被访问时,会在appDomain中产生独立的内存对象。比如appDomain1 appDomain2同时对 静态对象A有引用时,appDomain1.A与appDomain2.A是两个对象。

 1.

静态对象属性

public class StaticModel
{
public static int IndexTest;
}

2. 

public class myClass
{
public int index;
public void Invoke()
{
    using (TestProctectedCodeInvoke tc = new TestProctectedCodeInvoke())
    {
         LogHelper.Log("index:" + index + "----------Invoke thread .id:" + Thread.CurrentThread.ManagedThreadId, "ddd", 111);
         string saa = tc.test();
         Console.WriteLine(saa);
    }
}
}
public static void Main(string[] args)
        {

            LogHelper.Log("Main start", "ffffffffff", 111);
            int i = 0;
            try
            {
                while (i < 11)
                {
                    i++;
                    myClass mc = new myClass();
                    mc.index = i;
                    LogHelper.Log("Main thread index:  【" + i + "", "ffffffffff", 111);
                    Thread t = new Thread(mc.Invoke);
                    t.Start();
                    Thread.Sleep(100);
                    Console.WriteLine(i);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            LogHelper.Log("Main end", "ffffffffff", 111);
            Console.ReadLine();
        }
class TestProctectedCodeInvoke: IDisposable
    {
        public string test()
        {
            string dllpath = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory + "ClassLibrary1.dll");
            AssemblyDomain ad = new AssemblyDomain();
            object s = ad.Invoke(dllpath, "ClassLibrary1.Class1", "GetName");
            return s.ToString();
        }

        public void Dispose()
        {
            Console.WriteLine("Dispose");
        }
        ~TestProctectedCodeInvoke()
        {
            Console.WriteLine("TestProctectedCodeInvoke .xigou");
        }
    }

3. 输出结果

证明 StaticModel.IndexTest 是在各个domain中是独立的存在