You can use a ternary operator:
return new ADescription(file, name, othername==null?null:othername.ToList<string>());
Or create an extension method as described in the accepted response here Possible pitfalls of using this (extension method based) shorthand:
public static class IfNotNullExtensionMethod
{
public static U IfNotNull<T, U>(this T t, Func<T, U> fn)
{
return t != null ? fn(t) : default(U);
}
}
Your code would be:
return new ADescription(file, name, othername.IfNotNull(on => on.ToList());