首页> 外文期刊>MSDN Magazine >Get a Charge From Statics with Seven Essential Programming Tips
【24h】

Get a Charge From Statics with Seven Essential Programming Tips

机译:通过七个基本的编程技巧从静态学中收费

获取原文
获取原文并翻译 | 示例
           

摘要

It is rare that you would work on a .NET-based application and not encounter a type with a Shared method or static field. Since these abstractions have special behaviors, there are important questions to ask about the implementation. When will the runtime initialize the static fields? Is this method thread safe? Could this class cause a bottleneck? In this article, I will examine seven characteristics of statics that you should know. I will touch on the finer points of static constructors and how the C# and Visual Basic~(~R) compilers work together with the runtime to implement additional safety behind the scenes. By the end of the article, you will come away with best practices for the use of static members and static classes in your apps.
机译:您很少会在基于.NET的应用程序上工作,而不会遇到具有Shared方法或静态字段的类型。由于这些抽象具有特殊的行为,因此有一些关于实现的重要问题。运行时何时会初始化静态字段?此方法线程安全吗?此类可能造成瓶颈吗?在本文中,我将研究您应该知道的七个静态特性。我将介绍静态构造函数的优缺点,以及C#和Visual Basic〜(〜R)编译器如何与运行时一起使用,以在后台实现额外的安全性。到本文结尾,您将获得在应用程序中使用静态成员和静态类的最佳实践。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号