mirror of
https://github.com/Smaug123/WoofWare.PawPrint
synced 2025-10-14 18:18:40 +00:00
Implement Castclass
This commit is contained in:
22
WoofWare.PawPrint.Test/sourcesPure/IsinstFailed.cs
Normal file
22
WoofWare.PawPrint.Test/sourcesPure/IsinstFailed.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
public class Program
|
||||
{
|
||||
public class Bird
|
||||
{
|
||||
public bool CanFly { get; set; }
|
||||
}
|
||||
|
||||
public class Fish
|
||||
{
|
||||
public bool CanSwim { get; set; }
|
||||
}
|
||||
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
Bird sparrow = new Bird { CanFly = true };
|
||||
|
||||
// This should fail and return null (not throw)
|
||||
Fish fish = sparrow as Fish;
|
||||
|
||||
return fish == null ? 42 : 0;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user