C# Programming - Strings - Discussion

Discussion Forum : Strings - General Questions (Q.No. 7)
7.
What will be the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
    class SampleProgram
    {
        static void Main(string[ ] args)
        {
            string str= "Hello World!";
            Console.WriteLine( String.Compare(str, "Hello World?" ).GetType() );
        }
    }
}
0
1
String
Hello World?
System.Int32
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
14 comments Page 2 of 2.

Jay said:   1 decade ago
In this type ,we write
string.compare and use GetType() method then we find----System.Int32
string.Equals and use GetType() method then we find---System.Boolean
string.Join and use GetType() method then we find----System.System

Always remember

Harshil said:   1 decade ago
I think surekha is right.

Surekha said:   1 decade ago
I think it is because String.Compare () returns 0 or 1 which are nothing but of type int32.

Juhi said:   1 decade ago
Can anyone explain me this.


Post your comments here:

Your comments will be displayed after verification.