Which code segment should you use?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
Your project contains a folder named Data. You add a .MP3 file named song.mp3 in the Data folder.
You set the Build Action property of the application to Resource. You need to access the .MP3 file from one of the application classes.
Which code segment should you use?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
Your project contains a folder named Data. You add a .MP3 file named song.mp3 in the Data folder.
You set the Build Action property of the application to Resource. You need to access the .MP3 file from one of the application classes.
Which code segment should you use?

A.
Uri uri = new Uri("/Data/song.mp3", UriKind.Relative);
StreamResourceInfo sri = Application.GetContentStream(uri);
Stream stream = sri.Stream;

B.
Uri uri = new Uri("/Data/song.mp3", UriKind.Relative);
StreamResourceInfo sri = Application.LoadComponent(uri);
Stream stream = sri.Stream;

C.
Uri uri = new Uri("/Data/song.mp3", UriKind.Relative);
StreamResourceInfo sri = Application.GetRemoteStream(uri);
Stream stream = sri.Stream;

D.
Uri uri = new Uri("/Data/song.mp3", UriKind.Relative);
StreamResourceInfo sri = Application.GetResourceStream(uri);
Stream stream = sri.Stream;



Leave a Reply 0

Your email address will not be published. Required fields are marked *