Hello Mat

 找回密码
 立即注册
查看: 1091|回复: 0

类的实例化

[复制链接]

1294

主题

1520

帖子

110

金钱

管理员

Rank: 9Rank: 9Rank: 9

积分
22633
发表于 2023-4-19 21:29:58 | 显示全部楼层 |阅读模式
  1.            private static readonly object _lockObj = new object();

  2.         private static halcomcn _instance;

  3.      public static halcomcn Instance
  4.         {
  5.             get
  6.             {
  7.                 if (_instance == null)
  8.                 {
  9.                     lock (_lockObj)
  10.                     {
  11.                         if (_instance == null)
  12.                         {
  13.                             _instance = new halcomcn();
  14.                         }
  15.                     }
  16.                 }
  17.                 return _instance;
  18.             }
  19.         }
复制代码


算法QQ  3283892722
群智能算法链接http://halcom.cn/forum.php?mod=forumdisplay&fid=73
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Python|Opencv|MATLAB|Halcom.cn ( 蜀ICP备16027072号 )

GMT+8, 2024-4-19 15:02 , Processed in 0.226852 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表