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


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> .NET Framework >> Post New Question Subscribe to Interview Questions

What keyword returns null if a cast will not succeed?

Posted By :Narayanan     Posted Date :July 26, 2012    Points :40   Category :.NET Framework 
as

You can also find related Interview Question to What keyword returns null if a cast will not succeed?  below: 

What is the difference between NULL AND VOID pointer?

  
NULL can be value for pointer type variables.
VOID is a type identifier which has not size.
NULL and void are not same. Example: void* ptr = NULL; (More...)

What is a Null object?

  
It is an object of some class whose purpose is to indicate that a real object of that class does not exist. One common use for a null object is a return value from a member function that is supposed to return an object with some specified properties but cannot find such an object. (More...)

Yield keyword in C Sharp

  
C Sharp and yield keyword

Hi,



One of the cool and yet most unknown feature of the C# is the yield keyword. The yield keyword is used in an iterator block to provide a value to the enumerator object or to signal the end of the iteration. When used the expression is evaluated and returned as a value to the enumerator object. Note the expression has to be implicitebly convertible to yield type of the iterator. Here is an example



public static IEnumerable GetIntCollectionFromString(string SomeString){ string[] val = SomeString.Split(' '); int intToAdd; foreach (string token in val) { if (int.TryParse(token, out intVal)) { yield return intVal; } else { yield break; } }}

Here since we are using the yield keyword the function will return the collection of intVal instead of the value of intVal. The statement will only return when the iteration of the loop is complete.



There are some limitation with the yield keywords.

Unsafe blocks are not allowed
Parameters to the method, operator, or accessor cannot be ref or out. (More...)

Can you control concatenation of string values with null values?

  
Concatenation of string values with null values results either null value or string value.
We can control that by setting CONCAT_NULL_YIELDS_NULL on or off.
When it is set to ON, the concatenation will result null and when it is set to OFF, it will result the string.
Setting it ON,
SET CONCAT_NULL_YIELDS_NULL on;
print 'testing' + NULL; --results NULL and prints nothing

Setting it OFF,

SET CONCAT_NULL_YIELDS_NULL off;
print 'testing' + NULL; -- results testing and prints the same (More...)

What is NOT NULL Constraint?

  
A NOT NULL Constraint enforces that the column will not accept NULL values.The NOT NULL constraint are used to enforce domain integrity as the check constraint. (More...)

DateTime variables can be null (True / False )

  
False

The DateTime type is a non-nullable value type, and just like an integer, it cannot be assigned to null. (More...)

can we assign Null value to Struct variable.

  
No , We cannot assign null to a struct variable, since structs are value type. (More...)

What is a Null object?

  
It is an object of some class whose purpose is to indicate that a real object of that class does not exist. One common use for a null object is a return value from a member function that is supposed to return an object with some specified properties but cannot find such an object. (More...)

What is the use of param keyword in C#?

  
In C# param parameter allows us to create a method that may be sent to a set of identically typed arguments as a single logical parameter. (More...)

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