我NavigableMap在Java中多次使用该接口,它很方便.
具体来说,我喜欢使用它floorEntry和ceilingEntry方法,它们分别为您提供下一个最低或最高的映射条目.
我试图在C#中找到它们的等价物,但我很快就会出现.以下是我想要获得的一个例子.
我已经看过C#SortedDictionary和扩展方法了,虽然它看起来像是在球场,但我还没找到我正在寻找的东西.
谢谢!大号
package com.lewis.needsanavigablemapincsharp;
import java.util.NavigableMap;
import java.util.TreeMap;
public class Main {
public static void main(String[] args) {
NavigableMap<Float, String> neededMap = new TreeMap<Float, String>();
neededMap.put(1.0f, "first!");
neededMap.put(3.0f, "second!");
System.out.println("see how useful this is? (looking up indices that aren't in my map)");
System.out.println(neededMap.floorEntry(2.0f));
System.out.println(neededMap.ceilingEntry(2.0f));
}
}
Run Code Online (Sandbox Code Playgroud)
输出是:
看看这有用吗?(查找不在我的地图中的索引)
1.0 =首先!
3.0 =第二!
我正在尝试AccessibilityEvent使用 AccessibilityManager 和 TalkBack触发自定义。
该事件的用例是当用户单击操作栏时,片段轮询对象列表,然后根据列表的大小调整其 AccessibilityEvent 内容。
当我尝试运行它时,我没有收到预期的 TalkBack 消息。我很确定我在实例化 AccessibilityEvent 时遗漏了一些基本的东西。
我也不确定我是否需要使用,或者如何在AccessibilityDelegate此处应用s 因为回调来自 aMenuItem而不是 a View。我知道我可以调用findViewById以获取此 MenuItem 的视图,但我对这些 API 不是很了解。
关于这两点的任何指导都会很棒!
有问题的问题基本上由以下伪代码描述:
public class MyFragment extends Fragment {
//...
private List<Pojo> mPojoList;
//...
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.the_id_for_my_menuitem) {
if (booleanCheck() && !mPojoList.isEmpty()) {
//create the Accessibility event
final AccessibilityEvent event = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_CLICKED);
event.setContentDescription(String.format("deleting %2d pojos", mPojoList.size()));
//Send a custom accessibility event to let the …Run Code Online (Sandbox Code Playgroud) 我知道有一些问题已经存在,但似乎没有一个问题可以解决我的问题.
我正在调试VB.NET webForms应用程序,我无法使用FormsAuthentication.SetAuthCookie工作(使用非持久性cookie).它似乎在我在一个监视窗口中检查它时创建了一个HttpContext.Current.User对象,它似乎创建了该对象,但没有创建它的"Identity"属性.
我已经阅读了一些SO帖子检查了基本的东西,比如看我的浏览器是否支持cookie等等......这个项目是我们早期项目的直接端口,它对这里列出的所有东西使用相同的代码,相对而言,它的工作正常.抛出异常的地方是从我的BLL代码调用它应该得到它.
以下是调用FormsAuthentication方法的代码......:
'When participant logs in having already created records in DB.
Protected Sub btnGo_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnGo.Click
If Me.txtUsername.Text.Trim.Length <> 0 AndAlso Me.txtPassword.Text.Trim.Length <> 0 Then
If Membership.ValidateUser(Me.txtUsername.Text, Me.txtPassword.Text) Then
FormsAuthentication.SetAuthCookie(Me.txtUsername.Text, False)
'This is where we run into trouble; the property checks with the forms auth...
MyBLL.Common.CurrentUser = New MyBLL.User(Me.txtUsername.Text)
'set site property..
If Site_ IsNot Nothing Then
MyBLL.Common.CurrentUser.Site = Me.Site_
End If
MyBLL.Common.CurrentParticpant = Nothing
MyBLL.Common.CurrentParticpantVisitID = -1
Response.Redirect("~/Apps/Dashboard.aspx", …Run Code Online (Sandbox Code Playgroud)