public static void Run() { // begin using (var ressource = new NCrafts()) { } // end }
public decimal Run() { // begin var n = new NCrafts(); return(DoSomething(in n)); // end }
public static void Run() { // begin var nCrafts = new NCrafts(3); nCrafts.Array[0] = 42; // end Logger.Log("Value: ", nCrafts.Array[0]); }
public static unsafe void Run() { // begin var nCrafts = new NCrafts(); *nCrafts.Array = 42; // end Logger.Log("Value: ", *nCrafts.Array); }
public static unsafe void Run() { // begin var nCrafts = new NCrafts(3); fixed (int* p = nCrafts.Array) { *p = 42; } // end Logger.Log("Value: ", nCrafts.Array[0]); }
public static void Run() { // begin IDisposable resource = new NCrafts(); try { } finally { resource.Dispose(); } // end }
public static unsafe void Run() { // begin var nCrafts = new NCrafts(3); fixed(int *p = nCrafts.Array) { *p = 42; } // end Logger.Log("Value: ", nCrafts.Array[0]); }
public static void Run() { // begin IDisposable ressource = new NCrafts(); try { } finally { ressource.Dispose(); } // end }
public static void Run() { // begin var ressource = new NCrafts(); try { } finally { var disposableResource = ressource as IDisposable; if (disposableResource != null) disposableResource.Dispose(); } // end }
public static unsafe void Run() { var array = new NCrafts[10]; // begin for (var i = 0; i < array.Length; i++) { var value = new NCrafts(3); value.Array[0] = 1; array[i] = value; } // end Logger.Log("Value: ", array.Length); }
public static void Run() { // begin var resource = new NCrafts(); try { } finally { var disposableResource = resource as IDisposable; if (disposableResource != null) { disposableResource.Dispose(); } } // end }
private decimal DoSomething(NCrafts s) => s.Sum + s.Sum;