示例#1
0
            public static StringConversions__ElementType[] ConvertStringToElementTypeArray(string e)
            {
                if (string.IsNullOrEmpty(e))
                {
                    return(null);
                }

                var xml = StringConversions.ConvertStringToXElement(e);

                //<array c="2">
                //  <i0>2</i0>
                //  <i1>0</i1>
                //</array>

                //Console.WriteLine(new { xml });

                var Length = int.Parse(xml.Attribute("c").Value);

                //Console.WriteLine(new { Length });


                var y = new StringConversions__ElementType[Length];

                for (int i = 0; i < Length; i++)
                {
                    //Console.WriteLine(new { i });

                    y[i] = FromString(xml.Element("i" + i).Value);
                }

                return(y);
            }
示例#2
0
            public static List <StringConversions__ElementType> ConvertStringToListOfElementType(string e)
            {
                // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201405/20140517
                // X:\jsc.svn\examples\javascript\UIAutomationEvents\UIAutomationEvents\Application.cs
                // X:\jsc.svn\examples\javascript\test\TestWebMethodTaskOfIEnumerable\TestWebMethodTaskOfIEnumerable\ApplicationWebService.cs
                //return ConvertStringToElementTypeArray(e).AsEnumerable();

                #region return inline ConvertStringToElementTypeArray
                var xml = StringConversions.ConvertStringToXElement(e);

                //&lt;array c=&quot;2&quot;&gt;
                //  &lt;i0&gt;2&lt;/i0&gt;
                //  &lt;i1&gt;0&lt;/i1&gt;
                //&lt;/array&gt;

                //Console.WriteLine(new { xml });

                var Length = int.Parse(xml.Attribute("c").Value);

                //Console.WriteLine(new { Length });


                var y = new StringConversions__ElementType[Length];

                for (int i = 0; i < Length; i++)
                {
                    //Console.WriteLine(new { i });

                    y[i] = FromString(xml.Element("i" + i).Value);
                }

                return(y.ToList());

                #endregion
            }
示例#3
0
            public static IEnumerable <StringConversions__ElementType> ConvertStringToElementTypeEnumerable(string e)
            {
                //Additional information: Attempt by method 'mscorlib.<02000005IEnumerable\+ConvertToString>.ConvertToString(System.Collections.Generic.IEnumerable`1<TestIEnumerableForService.foo>)' to access method '<>f__AnonymousType6`1<System.__Canon>..ctor(System.__Canon)' failed.


                // X:\jsc.svn\examples\javascript\Test\TestIEnumerableForService\TestIEnumerableForService\ApplicationWebService.cs
                //Console.WriteLine("enter ConvertStringToElementTypeEnumerable " + new { e });
                //Console.WriteLine("enter ConvertStringToElementTypeEnumerable e:" + e);

                // X:\jsc.svn\examples\javascript\test\TestWebMethodTaskOfIEnumerable\TestWebMethodTaskOfIEnumerable\ApplicationWebService.cs
                //return ConvertStringToElementTypeArray(e).AsEnumerable();

                #region return inline ConvertStringToElementTypeArray
                var xml = StringConversions.ConvertStringToXElement(e);

                // X:\jsc.svn\examples\javascript\Test\TestIEnumerableForService\TestIEnumerableForService\ApplicationWebService.cs
                if (xml == null)
                {
                    return(null);
                }


                //&lt;array c=&quot;2&quot;&gt;
                //  &lt;i0&gt;2&lt;/i0&gt;
                //  &lt;i1&gt;0&lt;/i1&gt;
                //&lt;/array&gt;

                //Console.WriteLine(new { xml });

                var Length = int.Parse(xml.Attribute("c").Value);

                //Console.WriteLine(new { Length });


                var y = new StringConversions__ElementType[Length];

                for (int i = 0; i < Length; i++)
                {
                    //Console.WriteLine(new { i });

                    y[i] = FromString(xml.Element("i" + i).Value);
                }

                return(y.AsEnumerable());

                #endregion
            }
            public static StringConversions__ElementType[] ConvertStringToElementTypeArray(string e)
            {
                if (string.IsNullOrEmpty(e))
                    return null;

                var xml = StringConversions.ConvertStringToXElement(e);

                //&lt;array c=&quot;2&quot;&gt;
                //  &lt;i0&gt;2&lt;/i0&gt;
                //  &lt;i1&gt;0&lt;/i1&gt;
                //&lt;/array&gt;

                //Console.WriteLine(new { xml });

                var Length = int.Parse(xml.Attribute("c").Value);

                //Console.WriteLine(new { Length });


                var y = new StringConversions__ElementType[Length];

                for (int i = 0; i < Length; i++)
                {
                    //Console.WriteLine(new { i });

                    y[i] = FromString(xml.Element("i" + i).Value);
                }

                return y;
            }
            public static List<StringConversions__ElementType> ConvertStringToListOfElementType(string e)
            {
                // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201405/20140517
                // X:\jsc.svn\examples\javascript\UIAutomationEvents\UIAutomationEvents\Application.cs
                // X:\jsc.svn\examples\javascript\test\TestWebMethodTaskOfIEnumerable\TestWebMethodTaskOfIEnumerable\ApplicationWebService.cs
                //return ConvertStringToElementTypeArray(e).AsEnumerable();

                #region return inline ConvertStringToElementTypeArray
                var xml = StringConversions.ConvertStringToXElement(e);

                //&lt;array c=&quot;2&quot;&gt;
                //  &lt;i0&gt;2&lt;/i0&gt;
                //  &lt;i1&gt;0&lt;/i1&gt;
                //&lt;/array&gt;

                //Console.WriteLine(new { xml });

                var Length = int.Parse(xml.Attribute("c").Value);

                //Console.WriteLine(new { Length });


                var y = new StringConversions__ElementType[Length];

                for (int i = 0; i < Length; i++)
                {
                    //Console.WriteLine(new { i });

                    y[i] = FromString(xml.Element("i" + i).Value);
                }

                return y.ToList();
                #endregion
            }
 public static string ToString(StringConversions__ElementType e)
 {
     throw new NotSupportedException();
 }
            public static IEnumerable<StringConversions__ElementType> ConvertStringToElementTypeEnumerable(string e)
            {
                //Additional information: Attempt by method 'mscorlib.<02000005IEnumerable\+ConvertToString>.ConvertToString(System.Collections.Generic.IEnumerable`1<TestIEnumerableForService.foo>)' to access method '<>f__AnonymousType6`1<System.__Canon>..ctor(System.__Canon)' failed.


                // X:\jsc.svn\examples\javascript\Test\TestIEnumerableForService\TestIEnumerableForService\ApplicationWebService.cs
                //Console.WriteLine("enter ConvertStringToElementTypeEnumerable " + new { e });
                //Console.WriteLine("enter ConvertStringToElementTypeEnumerable e:" + e);

                // X:\jsc.svn\examples\javascript\test\TestWebMethodTaskOfIEnumerable\TestWebMethodTaskOfIEnumerable\ApplicationWebService.cs
                //return ConvertStringToElementTypeArray(e).AsEnumerable();

                #region return inline ConvertStringToElementTypeArray
                var xml = StringConversions.ConvertStringToXElement(e);

                // X:\jsc.svn\examples\javascript\Test\TestIEnumerableForService\TestIEnumerableForService\ApplicationWebService.cs
                if (xml == null)
                    return null;


                //&lt;array c=&quot;2&quot;&gt;
                //  &lt;i0&gt;2&lt;/i0&gt;
                //  &lt;i1&gt;0&lt;/i1&gt;
                //&lt;/array&gt;

                //Console.WriteLine(new { xml });

                var Length = int.Parse(xml.Attribute("c").Value);

                //Console.WriteLine(new { Length });


                var y = new StringConversions__ElementType[Length];

                for (int i = 0; i < Length; i++)
                {
                    //Console.WriteLine(new { i });

                    y[i] = FromString(xml.Element("i" + i).Value);
                }

                return y.AsEnumerable();
                #endregion
            }
            public static string ConvertElementTypeArrayToString(StringConversions__ElementType[] e)
            {
                //Unable to cast object of type 'System.Int32[]' to type 'System.Object[]'.

                //Console.WriteLine("enter ConvertElementTypeArrayToString");

                if (e == null)
                    return null;

                //var o = (object[])e;


                var xml = new XElement("array");

                var Length = e.Length;

                xml.Add(new XAttribute("c", "" + Length));

                for (int i = 0; i < Length; i++)
                {
                    // ldelem.ref ?
                    var item = e[i];

                    //                 [MethodAccessException: Attempt by method &#39;mscorlib.&lt;020000f3Array\+ConvertToString&gt;.ConvertToString(Int32[])&#39; to access method &#39;&lt;&gt;f__AnonymousType4d`2&lt;System.Int32,System.__Canon&gt;..ctor(Int32, System.__Canon)&#39; failed.]
                    //mscorlib.&lt;020000f3Array\+ConvertToString&gt;.ConvertToString(Int32[] ) +305


                    //Console.WriteLine("i: " + i + ", item: " + item);

                    xml.Add(new XElement("i" + i, ToString((StringConversions__ElementType)item)));
                }

                var value = StringConversions.ConvertXElementToString(xml);

                //Console.WriteLine("value: " + value);

                return value;
            }
示例#9
0
 public static string ToString(StringConversions__ElementType e)
 {
     throw new NotSupportedException();
 }