本文介绍了是否有Java的&QUOT之间的差异;同步"和C#的"锁定"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

做这两个关键字有相同的效果,或者是有什么我应该知道的?

Do these two keywords have exactly the same effect, or is there something I should be aware of?

推荐答案

据这个网站:http://en.csharp-online.net/CSharp_FAQ:_What_is_the_difference_between_CSharp_lock_and_Java_synchronized, C#锁定和Java 同步 code块是语义上相同,而对于方法,Java使用同步,而C#使用一个属性: [MethodImpl(MethodImplOptions.Synchronized)]

According to this site: http://en.csharp-online.net/CSharp_FAQ:_What_is_the_difference_between_CSharp_lock_and_Java_synchronized, C# lock and Java synchronized code blocks are "semantically identical", while for methods, Java uses synchronized while C# uses an attribute: [MethodImpl(MethodImplOptions.Synchronized)].

这篇关于是否有Java的&QUOT之间的差异;同步"和C#的"锁定"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 01:54