Convert/Cast base type to Derived type

前端 未结 5 1600
Happy的楠姐
Happy的楠姐 2020-12-20 17:12

I am extending the existing .NET framework class by deriving it. How do I convert an object of base type to derived type?

public class Results { //Framework          


        
5条回答
  •  粉色の甜心
    2020-12-20 17:36

    Results results = new MyResults();
       ...
    
    return (MyResults)results;
    

    should work. If not, then the problem is somewhere alse.

提交回复
热议问题