草庐IT

creating-virtual-environments

全部标签

c# - OOPS 概念 : What is the difference in passing object reference to interface and creating class object in C#?

我有一个类CustomerNew和一个接口(interface)ICustomer:publicclassCustomerNew:ICustomer{publicvoidA(){MessageBox.Show("Classmethod");}voidICustomer.A(){MessageBox.Show("Interfacemethod");}publicvoidB(){MessageBox.Show("ClassMethod");}}publicinterfaceICustomer{voidA();}我对这两行代码很困惑。ICustomerobjnew=newCustomerNe

c# - Firebase 3 : creating a custom authentication token using . 网络和 c#

我正在尝试使用自定义token实现Firebase3身份验证机制(如https://firebase.google.com/docs/auth/server/create-custom-tokens中所述)。我的服务器是ASP.NETMVC应用程序。因此,根据说明(https://firebase.google.com/docs/server/setup),我为我的Firebase应用程序创建了一个服务帐户,并生成了一个“.p12”格式的key。之后,根据此处的说明(https://firebase.google.com/docs/auth/server/create-custom-t

c# - Entity Framework 6 Create() 与 new

这两种方式添加实体有什么区别?MyEntityme=newMyEntity();entities.myentities.Add(me);对比MyEntityme=entities.myentities.Create();第二个例子还需要加“我”吗?如果是这样,是否有某种优势,无论是一种方式还是另一种方式?非常感谢! 最佳答案 MyEntityme=newMyEntity();将创建一个新的MyEntity实例MyEntityme=entities.myentities.Create();将创建MyEntity的代理包装实例(假设您的

C# 设计 : Why is new/override required on abstract methods but not on virtual methods?

为什么抽象方法需要new/override而虚方法不​​需要?示例1:abstractclassShapesClass{abstractpublicintArea();//abstract!}classSquare:ShapesClass{intx,y;publicintArea()//Error:missing'override'or'new'{returnx*y;}}编译器会显示这个错误:要使当前成员覆盖该实现,请添加override关键字。否则添加新关键字示例2:classShapesClass{virtualpublicintArea(){return0;}//itisvirt

c# - .NET Standard 1.4 的 Environment.MachineName 等效项

我正在创建一个将在WPF项目和.NETCore项目中使用的类库。我正在尝试使用我的应用程序获取机器的名称。在.NETCore和WPF应用程序中,我都可以使用Environment.MachineName值。但是在我的.NETStandard类库中我不能。我收到以下错误:'Environment'doesnotcontainadefinitionfor'MachineName'我尝试按照thisquestion中建议的答案进行操作但是当我尝试添加System.Windows.Networking.Connectivity.NetworkInformation.GetHostNames()

c# - 当不使用 Environment.Exit() 时,.net 程序可以有哪些退出代码?

如果.net程序未能在终止前明确设置退出代码(通过调用Environment.Exit()/Appliation.Current.Shutdown()/...),该进程的退出代码是什么?正常终止是否总是导致退出代码为零,其他可能的情况是什么?根据thisanswer相关问题GettingExitCodeFromExceptionHandler作者HansPassant:“如果一个程序因异常而死,那么它的退出代码通常与底层异常错误代码相同”。所以一个未被发现的异常可以改变退出代码。这种情况是否总是,底层异常错误代码是否始终保证不为零,并且在特定范围内?在其他情况下,.net框架或Wind

c# - 控制模板 : how to create bindings

因此,我有一个数据网格,它具有不同颜色的单元格,具体取决于单元格的值。我还有一个显示更多信息的工具提示。这一切都很好。但是,我想更改工具提示以显示更多信息并与单元格颜色相同。因此,我认为为我的工具提示创建自定义样式是明智的。所以,我有以下代码。我有一个绑定(bind)到我的数据网格的对象,如下所示。我想将这三个属性绑定(bind)到工具提示中的三个文本框。classMyTask{publicstringName;publicintCode;publicstringDescription;}在我的DataGrid中,我执行以下操作将我的数据绑定(bind)到我的数据网格ItemsSour

c# - 可以传递给 Environment.Exit 方法的默认值是什么?

可以传递给Environment.Exit方法的默认值是什么?每个代码的含义是什么? 最佳答案 0表示成功,其他任何表示错误。没有标准。有些程序试图符合惯例。这是微软的惯例。http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx 关于c#-可以传递给Environment.Exit方法的默认值是什么?,我们在StackOverflow上找到一个类似的问题: h

c# - "public new virtual void Method()"是什么意思?

什么时候使用新的虚关键字修饰方法?什么是感情?比如定义一个接口(interface),然后添加一个类来继承这个接口(interface)。而是使用新的virtual来实现接口(interface)方法。interfaceIPrinter{voidPrint();}publicclassPrinterOne:IPrinter{publicvoidPrint(){Console.WriteLine("PrinterOne.");}}publicclassPrinterTwo:PrinterOne{publicnewvirtualvoidPrint(){Console.WriteLine("

c# - HTML 敏捷包 : create html text node

在HtmlAgilityPack中,我想创建HtmlTextNode,这是一个HtmlNode(继承自HtmlNode)具有自定义InnerText。HtmlTextNodeCreateHtmlTextNode(stringname,stringtext){HtmlDocumentdoc=newHtmlDocument();HtmlTextNodetextNode=doc.CreateTextNode(text);textNode.Name=name;returntextNode;}问题是textNode.OuterHtml和textNode.InnerHtml在上述方法之后将等于“文