Which code segment should you use?

You implement a custom function as a user-defined function (UDF) in Excel Services in Microsoft Office SharePoint Server 2007. A Microsoft Office Excel 2007 workbook uses the custom function to generate a random number between 100 and 500. You need to generate a new random number each time you load the workbook. Which code segment should you use?

You implement a custom function as a user-defined function (UDF) in Excel Services in Microsoft Office SharePoint Server 2007. A Microsoft Office Excel 2007 workbook uses the custom function to generate a random number between 100 and 500. You need to generate a new random number each time you load the workbook. Which code segment should you use?

A.
public class MyUdfs
{
Random rand = new Random();
[UdfMethod]
public int GetRandomNumber()
{
return (rand.Next(100, 500));
}
}

B.
[UdfClass]
public class MyUdfs
{
Random rand = new Random();
[UdfMethod(IsVolatile=true)]
public int GetRandomNumber()
{
return (rand.Next(100, 500));
}
}

C.
[UdfClass]
public class MyUdfs
{
Random rand = new Random();
public int GetRandomNumber()
{
return (rand.Next(100, 500));
}
}

D.
public class MyUdfs
{
Random rand = new Random();
public int GetRandomNumber()
{
return (rand.Next(100, 500));
}
}



Leave a Reply 0

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