Click here to Skip to main content
15,891,473 members
Home / Discussions / C#
   

C#

 
GeneralRe: comparison with delegates Pin
kabutar24-Oct-07 21:08
kabutar24-Oct-07 21:08 
Questionkey up problem in template column of data grid Pin
veereshIndia24-Oct-07 19:13
veereshIndia24-Oct-07 19:13 
QuestionCryptoStream Pin
El Fenomeno24-Oct-07 19:00
El Fenomeno24-Oct-07 19:00 
QuestionHow can C# page play song ? Pin
whale8424-Oct-07 17:36
whale8424-Oct-07 17:36 
AnswerRe: How can C# page play song ? Pin
Martin#24-Oct-07 20:46
Martin#24-Oct-07 20:46 
GeneralRe: How can C# page play song ? Pin
whale8424-Oct-07 23:18
whale8424-Oct-07 23:18 
QuestionFullScreen Mode under Vista OS problem! [modified] Pin
Khoramdin24-Oct-07 17:22
Khoramdin24-Oct-07 17:22 
QuestionGetting NullReferenceException instead of ArgumentNullException Pin
JoeRip24-Oct-07 16:15
JoeRip24-Oct-07 16:15 
The .Net documentation for String.Contains() (http://msdn2.microsoft.com/en-us/library/system.string.contains.aspx) says it may raise the System.ArgumentNullException exception. This is the only exception listed for this method.

However, when I use this method to examine the contents of string based object properties, I'm getting the following exception instead:

System.NullReferenceException: Object reference not set to an instance of an object

Note that the exception doesn't happen unless I use the .Contains() method.

For instance, in the following code:

string myString = object.stringProperty;<br />
MessageBox.Show(myString);<br />
<br />
if (myString.Contains("a")) { ... }


no exception is thrown until the "if" statement is executed.

So, is the documentation incorrect, or is there something special about the empty string being held by the object property?
AnswerRe: Getting NullReferenceException instead of ArgumentNullException Pin
mid=574124-Oct-07 16:24
mid=574124-Oct-07 16:24 
GeneralRe: Getting NullReferenceException instead of ArgumentNullException Pin
JoeRip24-Oct-07 16:29
JoeRip24-Oct-07 16:29 
GeneralRe: Getting NullReferenceException instead of ArgumentNullException Pin
mid=574124-Oct-07 16:31
mid=574124-Oct-07 16:31 
GeneralRe: Getting NullReferenceException instead of ArgumentNullException Pin
JoeRip24-Oct-07 16:35
JoeRip24-Oct-07 16:35 
GeneralRe: Getting NullReferenceException instead of ArgumentNullException Pin
JoeRip24-Oct-07 16:51
JoeRip24-Oct-07 16:51 
GeneralRe: Getting NullReferenceException instead of ArgumentNullException Pin
mid=574124-Oct-07 17:18
mid=574124-Oct-07 17:18 
QuestionMerging Config files Pin
KrunalC24-Oct-07 15:50
KrunalC24-Oct-07 15:50 
QuestionRemoting and Events Issue Pin
nbize24-Oct-07 13:58
nbize24-Oct-07 13:58 
AnswerRe: Remoting and Events Issue Pin
John Whitmire2-Nov-07 6:26
professionalJohn Whitmire2-Nov-07 6:26 
QuestionIt seems that one window sits on the top and doesn't allow other windows to appear on it?!!! Pin
Khoramdin24-Oct-07 12:35
Khoramdin24-Oct-07 12:35 
AnswerRe: It seems that one window sits on the top and doesn't allow other windows to appear on it?!!! Pin
Christian Graus24-Oct-07 12:54
protectorChristian Graus24-Oct-07 12:54 
GeneralRe: It seems that one window sits on the top and doesn't allow other windows to appear on it?!!! Pin
Khoramdin24-Oct-07 17:10
Khoramdin24-Oct-07 17:10 
Question# color Pin
MasterSharp24-Oct-07 11:22
MasterSharp24-Oct-07 11:22 
AnswerRe: # color Pin
Luc Pattyn24-Oct-07 11:36
sitebuilderLuc Pattyn24-Oct-07 11:36 
GeneralRe: # color Pin
MasterSharp24-Oct-07 11:38
MasterSharp24-Oct-07 11:38 
GeneralRe: # color Pin
MasterSharp24-Oct-07 11:42
MasterSharp24-Oct-07 11:42 
GeneralRe: # color Pin
Luc Pattyn24-Oct-07 12:38
sitebuilderLuc Pattyn24-Oct-07 12:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.