草庐IT

ENTRY_POINT

全部标签

c# - 限制 Xamarin.Forms 中 Entry 字段的输入长度和字符

如何限制在Xamarin.Forms的Entry控件中输入的长度和字符。我需要创建自定义控件吗?有没有一种方法可以从Entry(或其他控件)派生,以便我可以应用必要的每个平台输入限制。例如,数字字段限制为最多3个字符,仅限数字。将Entry控件的键盘属性设置为Keyboard.Numeric仅为iOS设置键盘。它不限制实际的文本输入——即我仍然可以输入非数字字符。我也没有看到限制条目长度的方法。 最佳答案 您可以限制输入字段中的字符数,如下所示,intrestrictCount=//Enteryournumberofcharacte

c# - "The parameters dictionary contains a null entry for parameter"- 如何修复?

我正在尝试实现一个编辑页面,以便管理员修改数据库中的数据。不幸的是,我遇到了一个错误。下面的代码:publicViewResultEdit(intproductId){//Dosomethinghere}但是我收到这个错误:"Theparametersdictionarycontainsanullentryforparameter'productId'ofnon-nullabletype'System.Int32'formethod'System.Web.Mvc.ViewResultEdit(Int32)'in'WebUI.Controllers.AdminController'.To

c# - MVC : The parameters dictionary contains a null entry for parameter 'k' of non-nullable type 'System.Int32'

我是MVC的新手。在我的应用程序中,我正在从Mydatabase中检索数据。但是当我运行我的应用程序时,它会显示这样的错误这是我的网址http://localhost:7317/Employee/DetailsData/4ExceptionDetails:System.ArgumentException:Theparametersdictionarycontainsanullentryforparameter'k'ofnon-nullabletype'System.Int32'formethod'System.Web.Mvc.ActionResultDetailsData(Int32)

c# - DbSet.Attach(entity) 与 DbContext.Entry(entity).State = EntityState.Modified

当我处于分离场景并从客户端获取dto时,我将其映射到实体以保存它,我这样做:context.Entry(entity).State=EntityState.Modified;context.SaveChanges();DbSet.Attach(entity)有什么用?或者当EntityState.Modified已经附加实体时,为什么我应该使用.Attach方法? 最佳答案 当您执行context.Entry(entity).State=EntityState.Modified;时,您不仅将实体附加到DbContext,您还标记了整

c# - 为什么 HashSet<Point> 比 HashSet<string> 慢这么多?

我想存储一些不允许重复的像素位置,所以首先想到的是HashSet或类似的类(class)。然而,与HashSet之类的东西相比,这似乎非常慢.例如,这段代码:HashSetpoints=newHashSet();using(Bitmapimg=newBitmap(1000,1000)){for(intx=0;x大约需要22.5秒。虽然下面的代码(由于显而易见的原因,这不是一个好的选择)只需要1.6秒:HashSetpoints=newHashSet();using(Bitmapimg=newBitmap(1000,1000)){for(intx=0;x那么,我的问题是:这是有原因的吗?

c# - 如何修复 WPF 错误 : "Program does not contain a static ' Main' method suitable for an entry point"?

突然间,我的整个项目完全停止编译,并显示以下消息:Program'path_to_obj_project_folder'doesnotcontainastatic'Main'methodsuitableforanentrypoint我没有更改项目属性,只是添加了一些类,将其他一些类移到了文件夹中。它是一个WPF应用程序项目,因此应该没问题。入口点在它应该在的地方,文件App.xaml根本没有被修改:(我应该怎么做才能让它重新工作?注意供引用:如果重命名App.xaml可能会发生这种情况。正如OP所述,App.xaml没有改变;但是,这是为重命名App.xaml的任何人添加的。

接口(interface)的 golang 映射 - panic : assignment to entry in nil map

这个问题在这里已经有了答案:golang-howtoinitializeamapfieldwithinastruct?(3个答案)关闭7年前。我是golang的新手,我正在尝试创建一个类型为map[string]interface{}的映射。但是当我尝试创建一个不存在的新key时,我会收到运行时错误“panic:分配给nil映射中的条目”。谁能告诉我我做错了什么?去Playground:https://play.golang.org/p/vIEE0T11yl这是我的代码:packagemainfuncmain(){buffer:=Buffer{}buffer.AddRecord("my

dictionary - panic : assignment to entry in nil map on single simple map

我的印象是,只有当我们想要分配给双映射时,才会发生分配给entryinnil映射错误,也就是说,当尝试分配更深级别的映射而更高级别的映射时不存在,例如:varmmmap[int]map[int]intmm[1][2]=3但它也适用于一个简单的映射(尽管以结构作为键):packagemainimport"fmt"typeCOOstruct{xintyint}varneighboursmap[COO][]COOfuncmain(){fori:=0;i0{buds=append(buds,COO{x:i-1,y:j})}ifj0{buds=append(buds,COO{x:i,y:j-1}

转到 : assignment to entry in nil map

当尝试在下面的代码中为map(countedData)设置值时,我收到一条错误消息,提示assignmenttoentryinnilmap。funcreceiveWork(outPrintln不执行(因为错误发生在之前的留置权上)。有一些goroutines正在向channel发送数据,receiveWork方法应该制作这样的map:map=>"typeOne"=>[ChartElement,ChartElement,ChartElement,],"typeTwo"=>[ChartElement,ChartElement,ChartElement,]请帮我修正错误。

go - 运行时错误 "panic: assignment to entry in nil map"

我做了一个config.go来帮助编辑配置文件,但是我有一个错误,map为nil,这就是错误的来源:type(Contentmap[string]interface{}Configstruct{filestringconfigContentconfigTypeint})func(c*Config)Set(keystring,valueinterface{}){c.config[key]=value} 最佳答案 TheGoProgrammingLanguageSpecificationMaptypesAmapisanunordered