PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are using Visual Studio .NET to develop an application that uses a non-COM DLL named UsefulFunctions.dll. This DLL is written in unmanaged code. The DLL contains a function that parses a string into an array of string words and an array of numbers. A call to the function includes the following pseudocode: input = “A string with 6 words and 2 numbers” words = null numbers = null Parse(input, words, numbers) After execution, words contains all string words found in input and numbers contains all integers found in input. You need to enable your application to call this function. Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
[DllImport(“UsefulFunctions.dll”)]
public static extern void Parse(string input,
string[] words, int[] numbers);

B.
[DllImport(“UsefulFunctions.dll”)]
public static extern void Parse(string input,
ref string[] words, ref int[] numbers);

C.
[DllImport(“UsefulFunctions.dll”)]
public static extern void Parse(string input,
params string[] words, params int[] numbers);

D.
[DllImport(“UsefulFunctions.dll”)]
public static extern void Parse(string input,
[out] string[] words, [out] int[] numbers);


Leave a Reply