using System;
public class Program
{
public static void Main()
{
Console.WriteLine(DateTime.Now);
object obj = 1;
Console.WriteLine(obj.GetType());
Console.WriteLine(obj);
}
}
That works fine. Now, make the following change to the line where obj is declared:
dynamic obj = "hi";
Click the "Run" button again. The displayed output does not change. You'll still see the type as System.Int32, the value as 1, and the previous timestamp.
Did this error occur while using dotnet try or online?
[ ] dotnet-try
[x] online
What kind of error was it?
[ ] User Interface (UI): For example the output never displayed
[ ] Service Error: For example "The service is temporarily unavailable. We are working on it"
[x] Other:
Screenshots
If applicable, add screenshots to help explain your problem.
Describe the bug
Start with the following program at https://try.dot.net:
That works fine. Now, make the following change to the line where
obj
is declared:Click the "Run" button again. The displayed output does not change. You'll still see the type as
System.Int32
, the value as1
, and the previous timestamp.Did this error occur while using
dotnet try
or online?dotnet-try
What kind of error was it?
Screenshots
If applicable, add screenshots to help explain your problem.
Please complete the following: