Thursday, April 18, 2019

String to Array in C#

String to Array in C# 

 public object[] StringToArray(string sInput, string sSeparator, Type type)
        {
            string[] sStringList = sInput.Split(sSeparator.ToCharArray(),
                                              StringSplitOptions.RemoveEmptyEntries);
            object[] list = new object[sStringList.Length];

            for (int i = 0; i < sStringList.Length; i++)
            {
                list[i] = Convert.ChangeType(sStringList[i], type);
            }

            return list;
        }

No comments:

Post a Comment

UIWebView Deprecation and Xamarin.Forms

Apple started sending following warning messages about UIWebView deprecation. ITMS-90809: Deprecated API Usage - App updates that use UIWeb...