You searched for exceptions
. We found 168
results in 0.048 seconds.
No - the inner method doesn't return anything, because it throws an exception instead. The outer method simply doesn't have a result to work with. If a method throws an exception, it's generally expected that none of the work in the... more
The reason it's working for you is not because of the way CheckAsync is called, but because you're awaiting the result of Task.Delay. That will always return a "not completed yet" task, so awaiting it will schedule a continuation. That... more
I strongly suspect that either child1 or child1.kind are of type dynamic, meaning that the expression is deemed to be a dynamically-bound expression, despite everything else. Here's a short but complete example to demonstrate what I... more
This is because almost any operation involving a dynamic value is resolved dynamically at execution time. There are no exceptions made for cases where actually there's only one method present at compile-time; the language is simpler that... more
Ignore exceptions here. All you're seeing is the equivalent of this: public class Parent { private readonly string message; public string Message { get { return message; } } public Parent(string message) { ... more
The problem is the type of your expression tree - you're trying to represent a delegate of type Func<T, object>, and if the property returns an int, that means it would need to be converted. You just need to make the method generic... more
Why UpCasting does not require explicit casting ? Because it's always safe. It's never going to throw an exception. Why DownCasting requires explicit casting ? Because it's not safe. It can throw an exception, or lose... more
For exceptions you're throwing, you can just pass the message in to the constructor: throw new ArgumentOutOfRangeException("name", "My custom message"); Note that here, name is the name of the parameter that caused the problem. In C# 6,... more
You're asking to assign a sequence value to single entity variable. That's like trying to do this: // Won't work for the same reason string name = new List<string> { "foo", "bar" }; If you're just trying to find out whether there... more
I don't see any need to use a timer here. You can use a Stopwatch: class Example { private static readonly TimeSpan MinInterval = TimeSpan.FromSeconds(3); private readonly Stopwatch stopwatch = new Stopwatch(); // Stopped... more