c++

Howto. Execute MS SQL Stored Procedure With C#

At the moment I'm coding a small project for my university. I have to create a simple system on C# and Microsoft SQL Server 2005. So, I need a way (and code) to execute MS SQL Server's Stored Procedures from my C# program.

C#. Int array vs. ArrayList vs. Dictionary

private static void TestIntArray() { int [] array = new int[1000]; for (int i = 0; i < 1000; i++) array[i] = i; } private static void TestArrayList() { ArrayList array = new ArrayList(); for (int i = 0; i < 1000; i++) array.Add(i); } // Code.... long start = DateTime.Now.Ticks; TestIntArray(); long end = DateTime.Now.Ticks; Console.WriteLine("Time with int array: {0}", end - start); long start2 = DateTime.Now.Ticks; TestArrayList(); long end2 = DateTime.Now.Ticks; Console.WriteLine("Time with ArrayList array: {0}", end2 - start2);
The result:
Time

Point multiplication in Elliptic Curves

I was browsing the web for information about the binary multiplication (also known as "left-to-right multiplication") in Ellipti curves. I wrote a demonstration of the algorithm. Unfortunately, it's very brief version, but it might be interesting for someone :) This demonstration generates the right point multiplication sequency in binary multiplication of point. First - very short theory. Point multiplication is the operation: Q = k∙P. Point multiplication is the combination of point doubling and point addition.

Passing parameters in C#

In C we can use a function printf(), which can take different numbers of parameters. E.g.: printf("%d %s", a, b). How this can be done in C#? It can be done by keyword params: int Method(params int[] var) { int sum = 0; foreach (int i in var) sum += i; return sum; } // Code... Method(5, 2, 3); Method(64, 1); Method(9); More information: http://msdn.microsoft.com/en-us/library/w5zay9db(VS.71).aspx