Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
App.xaml iv'e で、アプリケーションの別のクラスで使用したくないオブジェクトを初期化しました
<Application.Resources> <local:DalEngine x:Key="_engine" x:Name="_engine"/> </Application.Resources>
同じ名前空間内のクラスからコードでこのオブジェクトを参照するにはどうすればよいですか?
名前空間は関係ありません。を使用できますApplication.Current.FindResource。(または直接Application.Current.Resources["_engine"])
Application.Current.FindResource
Application.Current.Resources["_engine"]