linux-packaging-mono/mcs/tests/dtest-error-04.cs

26 lines
425 B
C#
Raw Normal View History

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;
}
}