在泛型函数中创建实例 [英] Create instance in generic function
本文介绍了在泛型函数中创建实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hello Frnds,
我想初始化对象。我想为此创建通用函数。所以我调用它并传递类型参数并初始化对象
Hello Frnds,
I want to Initialize the object. and I want to create generic function for that. so I call thet and pass the type perameter and initialize the object
mainWindowViewModel.HideOtherScreens();
mainWindowViewModel.menu = new Menu() { DataContext = new MenuViewModel(_mainWindowViewModel) }; ;
mainWindowViewModel.menu.Visibility = Visibility.Visible; mainWindowViewModel._perentWindow.maincanvas.Children.Add(mainWindowViewModel.menu);
我有这种类型许多视图模型中的代码,即类,但初始化对象是diffrunt,即菜单,所以我需要为此创建通用函数
can你帮帮我
先谢谢你
I have this type of code in many viewmodels i.e. classes but the initilizing object is diffrunt i.e. Menu here so I need to create generic function for this
can you help me
Thanks in Advance
推荐答案
这篇关于在泛型函数中创建实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文