This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LockSimple // Un seul access, pas de async/await | |
{ | |
private readonly object lockObj = new object(); | |
public void DoStuff() | |
{ | |
// Si ya personne qui a lock "lockObj", on rentre et on lock. | |
// On unlock a la fin du block "lock (lockObj) {}" | |
lock (lockObj) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LockSimple // Un seul access, pas de async/await | |
{ | |
private readonly object lockObj = new object(); | |
public void DoStuff() | |
{ | |
// Si ya personne qui a lock "lockObj", on rentre et on lock. | |
// On unlock a la fin du block "lock (lockObj) {}" | |
lock (lockObj) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private string CalcLatitude() | |
{ | |
float reste = (float)Math.Abs(Y - 0.5f) * 180; | |
int deg = (int)reste; | |
reste -= deg; | |
reste *= 60; | |
int min = (int)reste; | |
reste -= min; | |
reste *= 60; | |
int sec = (int)reste; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
Console.WriteLine("Local addresses: "); | |
foreach (var address in Dns.GetHostEntry(Dns.GetHostName()).AddressList) | |
{ | |
Console.WriteLine($" {address}"); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ControllerDictionary<TKey, TValue, TCast> : Dictionary<TKey, TValue> where TValue : UIViewController where TCast : TValue | |
{ | |
public new TValue this[TKey key] | |
{ | |
get | |
{ | |
if (ContainsKey(key)) | |
{ | |
return base[key] as TCast; | |
} |