Вопрос

For example neither the BitConverter.GetBytes Method (Int64) nor XmlUrlResolver Constructor are not documented as throwing exceptions. Are they indicating an error by using a return value ?

Это было полезно?

Решение

Methods do not need to throw exceptions if their logic cannot give rise to any errors. This is obvious in the case of BitConverter.GetBytes; the conversion is guaranteed to succeed for any Int64 value.

There are some catastrophic exceptions that may be thrown by any method, such as OutOfMemoryException or StackOverflowException.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top