Category Archives: C#

Olvasási gyakorlat

Ez egy jó cikk : Covariance and Contravariance in C# 4.0 Előtte ezt is érdemes elolvasni : Liskov substitution principle ;meg ezt is ha már belejöttünk az olvasásba : Wiki (Ez utóbbi nekem annyira nem jött be, de vannak benne … Continue reading

Posted in C# | Leave a comment

Kolompeer swap without 3th variable

private void KolompeerSwap(ref int X,ref int Y) { X ^= Y; Y ^= X; X ^= Y; }

Posted in C# | Leave a comment

C# INumeric conception is bad

Can anyone tell me if there is a way with c# generics to limit a type T to only   The generics interview   Hacking Generics ( hack )          

Posted in C# | Leave a comment

Image with multi_for

         // Create an Image (320,200)          int Width = 320; int Height = 200;          using (Bitmap Image = new Bitmap(Width, Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb))          {               Algorithm.multi_for(new ulong[] { (ulong)Width, (ulong)Height }, delegate(ArraySegment<ulong> Indices)              {                  var Ix = (int)Indices.Array[Indices.Offset];                  var Iy = … Continue reading

Posted in C# | Leave a comment

C# Multifor, Dynamic count of nested loops

   public static class Algorithm    {        public delegate void OnIndexDelegate(ArraySegment<ulong> Indices);         public static void multi_for(ulong[] IterationCounts, OnIndexDelegate OnIndex)        {                       ulong v = (ulong)IterationCounts.Length +1;            ulong[] radix = new ulong[v];            radix[0] = 2;            ulong[] num   = new ulong[v];             … Continue reading

Posted in C# | Leave a comment

szöveg előfordulás számlálás

Func<string, string, int, int> f= null;f = (Text, Pattern, StartIndex) => !(StartIndex < Text.Length) || ((StartIndex = Text.IndexOf(Pattern, StartIndex)) < 0) ? 0 : 1 + f(Text, Pattern, StartIndex + 1); int count = f(a,b 0); //b előfordulásait akarjuk megszámlálni a-ban … Continue reading

Posted in C# | Leave a comment