예제 #1
0
        public void TestMethod1()
        {
            {
                string[]   headers = { "Test", "Header" };
                string[][] data    =
                {
                    new[] { "Foo", "Bar" },
                    new[] { "Kit", "Kat" }
                };
                Console.WriteLine(FlipTable.Of(headers, data));
            }

            {
                string[]   headers = { "Test", "Header" };
                string[][] data    =
                {
                };
                Console.WriteLine(FlipTable.Of(headers, data));
            }

            {
                string[]   headers = { "One Two\nThree", "Four" };
                string[][] data    = { new[] { "Five", "Six\nSeven Eight" } };
                Console.WriteLine(FlipTable.Of(headers, data));
            }

            {
                string[]   innerHeaders = { "One", "Two" };
                string[][] innerData    = { new[] { "1", "2" } };
                string     inner        = FlipTable.Of(innerHeaders, innerData);
                string[]   headers      = { "Left", "Right" };
                string[][] data         = { new[] { inner, inner } };
                Console.WriteLine(FlipTable.Of(headers, data));
            }

            {
                var personList = new List <Person>
                {
                    new Person("Junil", "Um", 37),
                };
                personList[0].Children.Add(new Person("A", "B", 12));
                Console.WriteLine(personList.FlipTablesFrom(FlipTablesPad.Right));
            }

            {
                var dt = new DataTable();
                dt.Columns.Add("FirstName");
                dt.Columns.Add("LastName");
                dt.Columns.Add("Age");
                var row1 = dt.NewRow();
                row1["FirstName"] = "Junil";
                row1["LastName"]  = "Um";
                row1["Age"]       = 37;
                dt.Rows.Add(row1);

                Console.WriteLine(dt.FlipTablesFrom());
            }

            {
                var person2 = new Person2()
                {
                    Name = new Name("Junil", null),
                    Age  = 37
                };
                Console.WriteLine(person2.FlipTablesFrom());
            }

            {
                var person2 = new Person2()
                {
                    Name = new Name("Junil", null),
                    Age  = 37
                };
                Console.WriteLine(person2.FlipTablesFrom(FlipTablesPad.Right));
            }
        }
예제 #2
0
 internal static string FlipTablesFromObject <T>(this T obj, FlipTablesPad pad = FlipTablesPad.Left) where T : class
 {
     return(FlipTable.Of(obj, pad));
 }
예제 #3
0
 public static string FlipTablesFrom(this DataSet dataSet, FlipTablesPad pad = FlipTablesPad.Left)
 {
     return(FlipTable.Of(dataSet, pad));
 }
예제 #4
0
 public static string FlipTablesFrom(this object obj, FlipTablesPad pad = FlipTablesPad.Left)
 {
     return(FlipTable.Of(obj, pad));
 }