Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace test
- {
- class Program
- {
- class C
- {
- public override string ToString()
- {
- return "C";
- }
- }
- class D : C
- {
- public override string ToString()
- {
- return "D";
- }
- }
- static void Main(string[] args)
- {
- Action<C> actc = ShowC;
- Action<D> actd = actc;
- Console.WriteLine("get "+(actd is Action<C>)); //true
- //Action<C> actc2 = actd; //所以這邊是真的沒救,沒辦法從 Action<D> 轉回 Action<C> 嗎?
- Console.ReadLine();
- }
- private static void ShowC(C c)
- {
- Console.WriteLine(c);
- }
- private static void ShowD(D d)
- {
- Console.WriteLine(d);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement