当前位置: 首页>>代码示例>>C#>>正文


C# DataTable.ToTaskResult方法代码示例

本文整理汇总了C#中System.Data.DataTable.ToTaskResult方法的典型用法代码示例。如果您正苦于以下问题:C# DataTable.ToTaskResult方法的具体用法?C# DataTable.ToTaskResult怎么用?C# DataTable.ToTaskResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.DataTable的用法示例。


在下文中一共展示了DataTable.ToTaskResult方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoEnterData

            //async 
            Task<DataTable> DoEnterData(

            [CallerFilePathAttribute] string CallerFilePath = null,
            [CallerLineNumberAttribute] int CallerLineNumber = 0,
            [CallerMemberNameAttribute] string CallerMemberName = null

            )
        {
            // X:\jsc.svn\examples\javascript\forms\Test\TestDataTableToJavascript\TestDataTableToJavascript\ApplicationWebService.cs

            var table = new DataTable { TableName = "DoEnterData " + new { reason }.ToString() };

            var column = new DataColumn();
            column.ColumnName = "Column 1";

            var column2 = new DataColumn();
            column2.ColumnName = "Column 2";

            table.Columns.Add(column);
            table.Columns.Add(column2);

            for (int i = 0; i < 32; i++)
            {
                var row = table.NewRow();

                row[column] = "#" + i;
                //row[column2] = new { reason, CallerMemberName, CallerLineNumber, CallerFilePath }.ToString();
                row[column2] = "John Doe, Canada | 600 USD";
                table.Rows.Add(row);
            }


            return table.ToTaskResult();
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:35,代码来源:ApplicationControl.cs

示例2: DoEnterData

            //async 
            Task<DataTable> DoEnterData(

            [CallerFilePathAttribute] string CallerFilePath = null,
            [CallerLineNumberAttribute] int CallerLineNumber = 0,
            [CallerMemberNameAttribute] string CallerMemberName = null

            )
        {
            // X:\jsc.svn\examples\javascript\forms\Test\TestDataTableToJavascript\TestDataTableToJavascript\ApplicationWebService.cs

            var table = new DataTable { TableName = "DoEnterData " + new { reason }.ToString() };

            var z = new Random().NextByte();

            var column = new DataColumn();
            column.ColumnName = "Column " + z;

            // An exception of type 'System.Data.DuplicateNameException' occurred in System.Data.dll but was not handled in user code
            //Additional information: A column named 'Column 2' already belongs to this DataTable.

            var column2 = new DataColumn();
            column2.ColumnName = "Column x2";

            table.Columns.Add(column);
            table.Columns.Add(column2);

            for (int i = 0; i < 32; i++)
            {
                var row = table.NewRow();

                row[column] = "#" + (i + z);
                //row[column2] = new { reason, CallerMemberName, CallerLineNumber, CallerFilePath }.ToString();
                row[column2] = "John Doe, Canada | 600 USD" + " | z " + z;
                table.Rows.Add(row);
            }


            return table.ToTaskResult();
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:40,代码来源:ApplicationWebService.cs

示例3: DoEnterData

            //async 
            Task<DataTable> DoEnterData(

            [CallerFilePathAttribute] string CallerFilePath = null,
            [CallerLineNumberAttribute] int CallerLineNumber = 0,
            [CallerMemberNameAttribute] string CallerMemberName = null

            )
        {
            // X:\jsc.svn\examples\javascript\forms\Test\TestDataTableToJavascript\TestDataTableToJavascript\ApplicationWebService.cs

            var table = new DataTable { TableName = "DoEnterData " + new { reason }.ToString() };

            var column = new DataColumn();
            column.ColumnName = "Column 1";

            // X:\jsc.svn\core\ScriptCoreLib.Ultra.Library\ScriptCoreLib.Ultra.Library\Library\StringConversions.StringArray.cs
            column.ReadOnly = true;

            var column2 = new DataColumn();
            column2.ColumnName = "Column 2";

            table.Columns.Add(column);
            table.Columns.Add(column2);

            for (int i = 0; i < 32; i++)
            {
                var row = table.NewRow();

                row[column] = "#" + i;
                //row[column2] = new { reason, CallerMemberName, CallerLineNumber, CallerFilePath }.ToString();
                row[column2] = "John Doe, Canada | 600 USD";
                table.Rows.Add(row);
            }



            table.ColumnChanged +=
           (s, a) =>
           {
               Console.WriteLine("Server ColumnChanged " + new { a.Row, a.Column, a.ProposedValue });
           };

            table.TableNewRow +=
                (s, a) =>
                {
                    Console.WriteLine("Server TableNewRow " + new { a.Row });

                };

            return table.ToTaskResult();
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:52,代码来源:ApplicationWebService.cs

示例4: GetInterfaces


//.........这里部分代码省略.........


            var g = from x in data

                    let get_key = new Func<bool>(
                        delegate
                        {
                            Console.WriteLine("get_key " + new { x.IsPrivate, x.IsLoopback, x.SupportsMulticast, x.IPv4 });



                            return x.IsPrivate && !x.IsLoopback && x.SupportsMulticast && x.IPv4;
                        }
                    )

                    let key = get_key()

                    // group by missing from scriptcorelib?

                    let gkey = new { x.u, x.n.Description, x.SupportsMulticast, key }
                    //let gvalue = new { key }

                    // Caused by: java.lang.RuntimeException: Implement IComparable for __AnonymousTypes__JVMCLRPrivateAddress__i__d_jvm.__f__AnonymousType_115__82__110_d_1 vs __AnonymousTypes__JVMCLRPrivateAddress__i__d_jvm.__f__AnonymousType_115__82__110_d_1

                    group gkey by key;



            // X:\jsc.svn\examples\javascript\forms\Test\TestDataTableToJavascript\TestDataTableToJavascript\ApplicationWebService.cs

            var table = new DataTable
            {

                TableName = "GetInterfaces"
            };




            var cAddress = new DataColumn
            {
                ColumnName = "Address",
                ReadOnly = true

            };

            table.Columns.Add(cAddress);

            var cComment = new DataColumn
            {
                ColumnName = "Comment",
                ReadOnly = true

            };

            table.Columns.Add(cComment);

            g.OrderByDescending(k => k.Key).WithEachIndex(
                (gx, gi) =>
                {

                    if (gi > 0)
                    {
                        var row = table.NewRow();

                        row[cAddress] = "";
                        row[cComment] = "";

                        table.Rows.Add(row);
                    }

                    gx.WithEach(
                          x =>
                          {
                              var row = table.NewRow();

                              row[cAddress] = x.u.Address.ToString();
                              row[cComment] = new
                              {

                                  x.key,
                                  x.SupportsMulticast,
                                  x.Description
                              }.ToString();

                              table.Rows.Add(row);
                          }
                      );

                }
            );






            return table.ToTaskResult();

        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:ApplicationWebService.cs

示例5: GetInterfaces


//.........这里部分代码省略.........
            // X:\jsc.svn\examples\javascript\forms\Test\TestDataTableToJavascript\TestDataTableToJavascript\ApplicationWebService.cs

            var table = new DataTable
            {

                TableName = "GetInterfaces"
            };


            var column = new DataColumn();
            column.ColumnName = "Name";
            column.ReadOnly = true;

            // An exception of type 'System.Data.DuplicateNameException' occurred in System.Data.dll but was not handled in user code
            //Additional information: A column named 'Column 2' already belongs to this DataTable.


            table.Columns.Add(column);


            var cSupportsMulticast = new DataColumn
            {
                ColumnName = "SupportsMulticast",
                ReadOnly = true

            };

            table.Columns.Add(cSupportsMulticast);

            var cGatewayAddresses = new DataColumn
            {
                ColumnName = "GatewayAddresses",
                ReadOnly = true

            };

            table.Columns.Add(cGatewayAddresses);



            NetworkInterface.GetAllNetworkInterfaces()

                .OrderByDescending(
                    k => k.GetIPProperties().UnicastAddresses.Count > 0
                )
            .WithEach(
                n =>
                {
                    var row = table.NewRow();

                    //row[column] = n.Id + " | " + n.Name;
                    row[column] = n.Name
                        + " | " + n.Description
                        //+ " | " + n.GetPhysicalAddress().GetAddressBytes().ToHexString()
                        ;

                    //Caused by: java.lang.NullPointerException
                    //        at ScriptCoreLib.Extensions.StringExtensions.ToHexString(StringExtensions.java:34)
                    //        at FormsNIC.ApplicationWebService___c__DisplayClass5._GetInterfaces_b__3(ApplicationWebService___c__DisplayClass5.java:45)
                    //        ... 54 more


                    //     //{ NetworkInterfaceName = net4, supportsMulticast = true, isUp = true, isVirtual = false, 
                    // DisplayName = Atheros AR9485WB-EG Wireless Network Adapter, 
                    // InetAddressesString = , /192.168.43.252, /fe80:0:0:0:55cc:63eb:5b4:60b4%11 }

                    row[cSupportsMulticast] = Convert.ToString(n.SupportsMulticast);

                    var IPProperties = n.GetIPProperties();
                    //var PhysicalAddress = n.GetPhysicalAddress();

                    var InetAddressesString = "";

                    // Address = {192.168.43.1}



                    IPProperties.UnicastAddresses.WithEach(
                        g =>
                        {
                            // IPv4 private addresses
                            // http://en.wikipedia.org/wiki/IP_address

                            InetAddressesString += "; " + g.Address;
                        }
                    );


                    row[cGatewayAddresses] = InetAddressesString;

                    Console.WriteLine(new { n.Description, InetAddressesString });
                    table.Rows.Add(row);

                }
            );


            return table.ToTaskResult();

        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:ApplicationWebService.cs


注:本文中的System.Data.DataTable.ToTaskResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。