Explore BrainMass

Explore BrainMass

    C# Programming and String Variable

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Hi, I need some help with a c# study guide and have a question:

    Assuming the string variable myvar contains the string literal "C# Programming", what will be written to the console for the following statements:
    (a) Console.Write(myvar.IndexOf("Prog'',3);
    (b) Console.Write(myvar.LastIndexOfAny('d');
    (c) Console.Write(myvar.CompareTo("myvar");
    (d) Console.Write(myvar.Substring(3,5);

    © BrainMass Inc. brainmass.com October 10, 2019, 7:34 am ad1c9bdddf

    Solution Preview

    (a) 3 will be written to the console since the string literal has "Prog" starting at index of 3.
    (b) -1 will ...

    Solution Summary

    This brief solution discusses C# string manipulation and lists what would be written to the console for the statements.