Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Declare two string variables and assign them with “Hello” and “World”.
- //Declare an object variable and assign it with the concatenation of the first two variables (mind adding an interval).
- // Declare a third string variable and initialize it with the
- //value of the object variable (you should perform type casting).
- using System;
- namespace _07_HelloObject
- {
- class HelloObject
- {
- static void Main()
- {
- string word1 = "Hello";
- string word2 = "world";
- object greeting = word1 + " " + word2;
- string castedGreeting = (string)greeting;
- Console.WriteLine(castedGreeting);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment