none
The C# string function "Split" RRS feed

  • Question

  • I wrote some code with VS 2017 in which I split up the input stream using the "Split" which appears to be the string class, and every thing went went.

    Recently, I tried to used the same technique and code while using VS 2019, the compiler gave all sorts of error messages which didn't make any scents and then said the "Split"  function was not part of string class even though the documentation said it was. I tried it with several different syntax but I got many errors and suggestions to repairs that didn't solve the problem. In one case the VS indicated that it was part of the string class and got to put it in, but other errors occurred.

    Is there something wrong in VS 2019 that prevents it working properly?

    Monday, December 30, 2019 10:07 PM

Answers


  • Recently, I tried to used the same technique and code while using VS 2019, the compiler gave all sorts of error messages which didn't make any scents and then said the "Split"  function was not part of string class even though the documentation said it was. 

    Is there something wrong in VS 2019 that prevents it working properly?

    We can't give an informed opinion unless you provide:

    (1) Example (actual) code that generates the errors.

    (2) The *actual* error messages. Copy & Paste or a screen capture.

    (3) Specifics about what kind of project it is - which template was used, etc.

    I seriously doubt that there is a bug in the String class in VS 2019. If there
    were, thousands of developers from all over the globe would have been screaming
    night and day by now.

    Note that strange error messages often occur as the result of some earlier and
    often unrelated bug in the code. The compiler gets "confused" and parses code
    after the initial bug incorrectly.

    - Wayne

    Monday, December 30, 2019 11:44 PM
  • Hi Big Dad,

    Thank you for posting here.

    If the string class is wrong, it will have a huge impact. But we haven't heard anything about it so far.

    So I have a guess. Do you name your class "String"?

    Like this:

    If my guess is wrong, please provide the information that Wayne said.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, December 31, 2019 2:24 AM

All replies


  • Recently, I tried to used the same technique and code while using VS 2019, the compiler gave all sorts of error messages which didn't make any scents and then said the "Split"  function was not part of string class even though the documentation said it was. 

    Is there something wrong in VS 2019 that prevents it working properly?

    We can't give an informed opinion unless you provide:

    (1) Example (actual) code that generates the errors.

    (2) The *actual* error messages. Copy & Paste or a screen capture.

    (3) Specifics about what kind of project it is - which template was used, etc.

    I seriously doubt that there is a bug in the String class in VS 2019. If there
    were, thousands of developers from all over the globe would have been screaming
    night and day by now.

    Note that strange error messages often occur as the result of some earlier and
    often unrelated bug in the code. The compiler gets "confused" and parses code
    after the initial bug incorrectly.

    - Wayne

    Monday, December 30, 2019 11:44 PM
  • Hi Big Dad,

    Thank you for posting here.

    If the string class is wrong, it will have a huge impact. But we haven't heard anything about it so far.

    So I have a guess. Do you name your class "String"?

    Like this:

    If my guess is wrong, please provide the information that Wayne said.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, December 31, 2019 2:24 AM
  • Hi Big Dad,

    Has your issue been resolved?

    If so, please click "Mark as answer" to the appropriate answer, so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 6, 2020 8:35 AM
  • Hello,

    Have you taken time to read the documentation which has six overloads and examples to learn from.

    https://docs.microsoft.com/en-us/dotnet/csharp/how-to/parse-strings-using-split


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Monday, January 6, 2020 10:46 AM
    Moderator
  • try this simple tutorial on...C# string split
    Tuesday, January 7, 2020 6:31 AM