linux-packaging-mono/mcs/tests/dtest-error-04.cs
Xamarin Public Jenkins (auto-signing) 966bba02bb Imported Upstream version 5.2.0.175
Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
2017-06-07 13:16:24 +00:00

26 lines
425 B
C#

using System;
using Microsoft.CSharp.RuntimeBinder;
class A
{
public string Value;
}
public class Test
{
public static int Main ()
{
dynamic d = new A ();
try {
d.Value = (object)"value";
return 1;
} catch (RuntimeBinderException e) {
if (e.Message != "Cannot implicitly convert type 'object' to 'string'. An explicit conversion exists (are you missing a cast?)")
return 2;
}
return 0;
}
}