Ejemplo n.º 1
0
        public string StateToString(int[,] state)
        {
            string str = "";

            for (int j = 0; j < SizeC; j++)
            {
                str += state[0, j] == 0 ? "  " : $"{IntToStr(state[0, j])}{(BlockedPos[0,j] ? '╴' : ' ')}";
                if ((j + 1) % SquareSizeC == 0 && j < SizeC - 1)
                {
                    str += "│ ";
                }
            }
            for (int i = 1; i < SizeR; i++)
            {
                str += '\n';
                for (int j = 0; j < SizeC; j++)
                {
                    str += state[i, j] == 0 ? "  " : $"{IntToStr(state[i, j])}{(BlockedPos[i, j] ? '╴' : ' ')}";
                    if ((j + 1) % SquareSizeC == 0 && j < SizeC - 1)
                    {
                        str += "│ ";
                    }
                }
                if ((i + 1) % SquareSizeR == 0 && i < SizeR - 1)
                {
                    str += '\n';
                    for (int j = 0; j < SizeC; j++)
                    {
                        if ((j + 1) % SquareSizeC == 0 && j < SizeC - 1)
                        {
                            str += "──┼─";
                        }
                        else
                        {
                            str += "──";
                        }
                    }
                }
            }
            return(str);
        }
        public void Lambdas()
        {
            Expression <Func <int, string> > expressionLambda = x => x.ToString();
            Func <int, string> delegateLambda  = x => x.ToString();
            IntToStr           delegateLambda2 = x => x.ToString();
            var delegateLambda3 = expressionLambda.Compile();

            //var expressionLambda2 = x => x.ToString(); [CS0815]
            IEnumerable <int> enumerable = new int[] { };
            IQueryable <int>  queryable  = enumerable.AsQueryable();

            queryable.Select(expressionLambda);
            queryable.Select(delegateLambda);

            enumerable.Select(delegateLambda);
            //enumerable.Select(expressionLambda); [CS1929]
        }