Microsoft .NET 面试题与答案
Test your skills through the online practice test: Microsoft .NET Quiz Online Practice Test
问题 31. Write code to show how a method can accept a varying number of parameters.
using System;
namespace Console1
{
class Class1
{
static void Main(string[] args)
{
ParamsMethod(1,"example");
ParamsMethod(1,2,3,4);
Console.ReadLine();
}
static void ParamsMethod(params object[] list)
{
foreach (object o in list)
{
Console.WriteLine(o.ToString());
}
}
}
}
这有帮助吗?
添加评论
查看评论
问题 32. What is an overloaded method?
An overloaded method has multiple signatures that are different.
这有帮助吗?
添加评论
查看评论
问题 33. What is recursion?
Recursion is when a method calls itself.
这有帮助吗?
添加评论
查看评论
问题 34. What is a constructor?
A constructor performs initialisation for an object (including the struct type) or class.
这有帮助吗?
添加评论
查看评论
问题 35. If I have a constructor with a parameter, do I need to explicitly create a default constructor?
Yes
这有帮助吗?
添加评论
查看评论
用户评价最有帮助的内容:
- Name 10 C# keywords.
- What is public accessibility?
- .NET Stands for?
- What is private accessibility?
- What is protected accessibility?