Skip to content

Commit 8e41358

Browse files
committed
C#: Add dispatch examples for partial properties and indexers.
1 parent cdf332c commit 8e41358

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

csharp/ql/test/library-tests/dispatch/ViableCallable.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,3 +618,37 @@ public void Run2<T>(T t) where T : I, allows ref struct
618618
t.M();
619619
}
620620
}
621+
622+
public class C22
623+
{
624+
public partial class Partial1
625+
{
626+
public partial object Property { get; set; }
627+
628+
public partial object this[int index] { get; set; }
629+
}
630+
631+
public partial class Partial1
632+
{
633+
public partial object Property { get { return null; } set { } }
634+
635+
public partial object this[int index] { get { return null; } set { } }
636+
}
637+
638+
public void Run1(Partial1 p)
639+
{
640+
object o;
641+
642+
// Viable callable: Partial1.set_Property
643+
p.Property = new object();
644+
645+
// Viable callable: Partial1.get_Property
646+
o = p.Property;
647+
648+
// Viable callable: Partial1.set_Item(int, object)
649+
p[0] = new object();
650+
651+
// Viable callable: Partial1.get_Item(int)
652+
o = p[0];
653+
}
654+
}

0 commit comments

Comments
 (0)