I was reading File.AppendAllText
method from msdn
http://msdn.microsoft.com/en-us/library/ms143356.aspx
I saw they have listed FileNotFoundException
to possible exceptions list for the method but according to there description about method on the same page
Opens a file, appends the specified string to the file, and then closes the file. If the file does not exist, this method creates a file, writes the specified string to the file, then closes the file.
this part
If the file does not exist, this method creates a file
it seems this exception can never be thrown for this method.
If you take a look at (say) Mono's implementation (which is compatible with Microsoft's), all File.AppendAllText
ends up doing (argument checks aside) is creating a StreamWriter
with your path and calling a Write
on that object.
Neither the used constructor nor the method are listed anywhere to throw a FileNotFoundException
, as far as I can tell, so it might be a documentation error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With