我有一个div,它以以下格式显示名称,日期和时间:
By John Doe on: mm/dd/yyyy HH:MM AM
Run Code Online (Sandbox Code Playgroud)
我要显示的区域是固定宽度,如果用户名太长,可以像这样缩短时间:
By John Doe on: mm/dd/yyyy HH:MM
AM
Run Code Online (Sandbox Code Playgroud)
当我希望有时间包装AM / PM时
By John Doe on: mm/dd/yyyy
HH:MM AM
Run Code Online (Sandbox Code Playgroud)
有没有一种设置断点或类似概念的方法来告诉页面它可以在日期和时间之间中断,而不能在时间和AM / PM之间中断?
我在尝试实现泛型时注意到,具有实现接口的泛型的类与具有扩展基类的泛型的类之间存在不同的行为。使用接口,我无法调用采用接口类型的 Enumerable 的函数,但使用该类,一切都正常。这是一个例子
public interface IBarInterface
{
public int Value { get; set; }
}
public class FooInterface<TInterface> where TInterface : IBarInterface
{
private List<TInterface> _items;
public List<TInterface> Items => _items;
// Does not compile:
// Argument type 'System.Collections.Generic.List<TInterface>' is not assignable to parameter type 'System.Collections.Generic.IEnumerable<IBarInterface>'
public bool SomeValue => Processors.DoSomethingInterface(_items);
public FooInterface()
{
_items = new List<TInterface>();
}
}
public class BarClass
{
public int Value { get; set; }
}
public class FooClass<TClass> where TClass : BarClass
{ …Run Code Online (Sandbox Code Playgroud)