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

推荐订阅源

博客园 - 三生石上(FineUI控件)
O
OpenAI News
WordPress大学
WordPress大学
P
Proofpoint News Feed
J
Java Code Geeks
G
Google Developers Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Register - Security
The Register - Security
Engineering at Meta
Engineering at Meta
H
Help Net Security
人人都是产品经理
人人都是产品经理
Vercel News
Vercel News
N
Netflix TechBlog - Medium
F
Full Disclosure
U
Unit 42
Latest news
Latest news
N
News and Events Feed by Topic
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
I
InfoQ
L
LINUX DO - 最新话题
T
Threat Research - Cisco Blogs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
爱范儿
爱范儿
K
Kaspersky official blog
Google Online Security Blog
Google Online Security Blog
小众软件
小众软件
I
Intezer
V
V2EX
S
SegmentFault 最新的问题
C
CERT Recently Published Vulnerability Notes
阮一峰的网络日志
阮一峰的网络日志
Security Archives - TechRepublic
Security Archives - TechRepublic
Recent Announcements
Recent Announcements
C
Check Point Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Recorded Future
Recorded Future
博客园 - Franky
Project Zero
Project Zero
S
Securelist
Attack and Defense Labs
Attack and Defense Labs
Spread Privacy
Spread Privacy
The Hacker News
The Hacker News
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
博客园 - 叶小钗
NISL@THU
NISL@THU
云风的 BLOG
云风的 BLOG
S
Secure Thoughts
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed

博客园 - 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中是独立的存在