Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
CallBy Val Vs Ref Double
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Diagnostics; namespace Rextester { public class Program { public static void Main(string[] args) { int aCount = 1000000; double aSum = 0; Stopwatch aWatch = Stopwatch.StartNew(); for(double i=0;i<aCount;i++) { aSum = CallByValue(i,i); } aWatch.Stop(); Console.WriteLine("Call By Value Took {0}",aWatch.Elapsed); aWatch.Start(); for(double i=0;i<aCount;i++) { CallByRef(ref i,ref i,ref aSum); } aWatch.Stop(); Console.WriteLine("Call By Ref Took {0}",aWatch.Elapsed); } public static double CallByValue(double one, double two) { return one+two; } public static void CallByRef(ref double one, ref double two,ref double theOut) { theOut = one+two; } } }
run
|
edit
|
history
|
help
2
фабрика статик
IotaSeedGenerator
Homework3
HashPassword
Boggle
cte-like constructs in C#
Vignere Cipher
I know it's a bit combersome, but it's my first attempt.
AlphabeticalRank
CRC 8 bit Table calculation