locked
Convert to object[] RRS feed

  • Question

  • User-148788041 posted

    Hi,

    I have a string like this i want to convert to object[]

    ("name","Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;
    Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;","Address 1","Address 2")

    Also convert to string[]

    Monday, August 27, 2018 5:13 PM

All replies

  • User475983607 posted

    This is fundamental C# arrays. 

    string[] array = { "name", "Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;", "Address 1", "Address 2" };
    
    foreach(string s in  array)
    {
        Console.WriteLine(s);
    }

    See arrays in the C# programming guide.

    https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/arrays/

    Monday, August 27, 2018 5:24 PM
  • User-148788041 posted

    split as seperate string

    name,

    "Data Source=190.190.200.100,1433
    Monday, August 27, 2018 5:27 PM
  • User475983607 posted

    split as seperate string

    name,

    "Data Source=190.190.200.100,1433

    I'm not sure what you're asking.  

    Monday, August 27, 2018 5:39 PM