.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Kaviya Balasubramanian
Sgraph Infotech
Imran Ghani

Home >> Interview Question >> C# >> Post New Question Subscribe to Interview Questions

Define Optional and Named Parameter in C# 4.0

Posted By :Narayanan     Posted Date :January 16, 2013    Points :40   Category :C# 
Optional parameter allows omitting arguments to function while named parameters allow passing arguments by parameter name.


I was trying to use an "out int" parameter in one of my functions. How should I declare the variable that I am passing to it?

You should declare the variable as an int, but when you pass it in you must specify it as 'out', like the following: int i; foo(out i); where foo is declared as follows: [return-type] foo(out int o) { } (More...)

How do I simulate optional parameters to COM calls?

You must use the Missing class and pass Missing.Value (in System.Reflection) for any values that have optional parameters. (More...)

What are the different parameter passing techniques c# supports?

byvalue (default),byreference,out and paramarray (More...)

How to install a strong named assembly to GAC at command prompt?

We can use a developer tool called the Global Assembly Cache tool (Gacutil.exe), provided by the .NET Framework SDK or Use Windows Explorer to drag assemblies into the cache.

To install a strong-named assembly into the global assembly cache at the command prompt, type the following command:
gacutil I Asembly_name

In this command, assembly_name is the name of the assembly to be installed in the GAC. (More...)

You can also find related Interview Question to Define Optional and Named Parameter in C# 4.0  below: 

Define namespace in C++ ?

It is a feature in c++ to minimize name collisions in the global name space. This namespace keyword assigns a distinct name to a library that allows other libraries to use the same identifier names without creating any name collisions. Furthermore, the compiler uses the namespace signature for differentiating the definitions. (More...)

Define precondition and post-condition to a member function.

A precondition is a condition that must be true on entry to a member function. A class is used correctly if preconditions are never false. An operation is not responsible for doing anything sensible if its precondition fails to hold.
For example, the interface invariants of stack class say nothing about pushing yet another element on a stack that is already full. We say that isful() is a precondition of the push operation.

A post-condition is a condition that must be true on exit from a member function if the precondition was valid on entry to that function. A class is implemented correctly if post-conditions are never false.
For example, after pushing an element on the stack, we know that isempty() must necessarily hold. This is a post-condition of the push operation. (More...)

Define the "integrity rules"

There are two Integrity rules.
1.Entity Integrity: States that "Primary key cannot have NULL value"

2.Referential Integrity: States that "Foreign Key can be either a NULL value or should be Primary Key value of other relation. (More...)

Can we pass more than one querystring parameter with hyperlink in .aspx file?

Yes we can.
Code can be like,
NavigateUrl='<%# "Page.aspx?param1=" & _
DataBinder.Eval(Container.DataItem, "param1") & _
"¶m2=" & DataBinder.Eval(Container.DataItem, "param2") %>'
Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend