inline-if

How to write strongly typed lambda expressions?

I want to write a lambda expression within an inline if statement. But inline if statement must have strong type results. MyType obj = someObj.IsOk ? null : () => { MyType o = new MyType(intVal); o.PropertyName = false; return o; }; Of course this doesn't work, because lambda expression isn't strongly typed. I thought of usin...

inline if and interfaces (polymorphism)

public class Foo : IFooBarable {...} public class Bar : IFooBarable {...} So why then will this not compile... int a = 1; IFooBarable ting = a == 1 ? new Foo() : new Bar(); but this will... IFooBarable ting = a == 1 ? new Foo() : new Foo(); IFooBarable ting = a == 1 ? new Bar() : new Bar(); ...

vb.net inline IF with OR... not evaluating

I'm working on a small problem where I'm trying to show/hide a panel based on two criteria A specific data field must not be blank The specific data filed must also not equal "Not Relocatable" Unfortunately this doesn't seem to be working for me (note that setting either one or the other criteria works just fine.) <asp:Panel...