2017년 8월 21일 월요일

Covariance vs Contravariance

covariance : converting from wider to narrower (넓은것에서 좁은것으로의 변환)

contravariance : converting from narrower to wider (좁은것에서 넓은것으로의 변환)


제네릭 인터페이스에서 형식 매개 변수가 다음 조건을 충족하는 경우 공변(covariant)으로 선언할 수 있습니다.
  • 형식 매개 변수는 인터페이스 메서드의 반환 형식으로만 사용되고 메서드 인수의 형식으로 사용되지 않습니다.

형식 매개 변수는 인터페이스 메서드에 대한 제네릭 제약 조건으로 사용되지 않습니다.


   interface INoraml { }
    class NormalSample : INoraml { }



    interface ICovariant { }
    class Sample : ICovariant { }

    interface IContravariant { }
    class SampleContra : IContravariant { }


    public class covriance
    {
      public void main()
        {
            ICovariant iobj = new Sample();
            ICovariant istr = new Sample();
            ICovariant iobst = new Sample();

            iobj = istr;
        }

        public void main2()
        {
            INoraml iobj = new NormalSample();
            INoraml istr = new NormalSample();
            INoraml iobst = new NormalSample();
            iobj = istr;
            istr = iobj;
        }

        public void main3()
        {
            IContravariant iobj = new SampleContra();
            IContravariant istr = new SampleContra();
            IContravariant iobst = new SampleContra();
            iobj = istr;
            istr = iobj;
        }

[bitplex] 분석

데이터 로드 

MxFile은 전역변수 

1. MxFile에 "ptnmap_depth1" 이 있는지 체크 
!Data.HasData(partition_name)
DataHeaders.Any(x => x.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase));
//https://msdn.microsoft.com/ko-kr/library/system.stringcomparison(v=vs.110).aspx

2. "ptnmap_depth1" 이 있다면 

2-1 : MxDataHeader

2017년 8월 17일 목요일

[C#] enum name to string

public enum Teste { ab ,abg}
    class Program
    {
        static void Main( string [ ] args )
        {
            var strlist = Enum.GetNames(typeof(Teste)); // To String List
            var name = Teste.ab.ToString();  // single string

            Console.ReadLine();



        }
    }

[C#] Jagged Array Property

 int[][] temp = new int[2][] {
               new int[] {2,4},
               new int[] {3,2}
           };

            int[][] temp2 = new int[2][] {
               new int[] {20,2,4,5,4},
               new int[] {30,40}
           };

            temp [ 0 ] = temp2 [ 0 ];
            temp [ 0 ] = temp2 [ 0 ];



[C#] Get Files in Folder

 FolderBrowserDialog ofd = new FolderBrowserDialog();
            if ( ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK )
            {
                try
                {
                    FileNamesList = new List();
                    Directory.GetFiles( ofd.SelectedPath ).Where( x => System.IO.Path.GetExtension(x) == ".jpg").Select( x => x).ToList();
                   




                    var result = SingleProcessing( new Image( ofd.FileName ) , true);
                    mainimg.ImageSource = result.Item1.ToBitmapSource();
                }
                catch ( Exception )
                {
                }
            }

2017년 8월 14일 월요일

[c#] partial application

 public static Func>> tt => str1 => str2 => str3 => Console.WriteLine( str1 + str2 + str3 );


        static void Main( string [ ] args )
        {
            var temp1 = tt("2");
            var temp2 = tt("2")("3");

        }