草庐IT

custom-class

全部标签

c# - Linq Getting Customers 按日期分组,然后按类型分组

我正在使用C#中的LINQ生成报告以向客户展示。我想显示没有。每种类型的客户。注册的客户有客人和经理三种类型。我想按客户注册日期分组,然后按客户类型分组。即,如果今天插入了3位客人、4位注册人和2位经理。明天4,5和6分别注册。然后报告应显示当天注册的客户数量。每种类型单独一行。DATETYPEOFCUSTOMERCOUNT31-10-2013GUEST331-10-2013REGISTERED431-10-2013MANAGER230-10-2013GUEST530-10-2013REGISTERED1030-10-2013MANAGER3像这样。varsubquery=fromea

c# - 公共(public)静态字符串 MyFunc() 上的 "Expected class, delegate, enum, interface or struct"错误。什么 's an alternative to "字符串”?

当我尝试使用以下静态函数时出现错误。错误:Expectedclass,delegate,enum,interface,orstruct函数(和类):namespaceMyNamespace{publicclassMyClass{//SomeotherstaticmethodsthatuseClasses,delegates,enums,interfaces,orstructspublicstaticstringMyFunc(stringmyVar){stringmyText=myVar;//DosomestuffwithmyTextandmyVarreturnmyText;}}}这导致

c# - 为什么我不能将 List<Customer> 作为参数传递给接受 List<object> 的方法?

下面的代码给我这个错误:Cannotconvertfrom'System.Collections.Generic.List'to'System.Collections.Generic.List'.我如何向编译器表明Customer确实继承自对象?或者它只是不对通用集合对象进行继承(发送List会得到相同的错误)。usingSystem.Collections.Generic;usingSystem.Windows;usingSystem.Windows.Documents;namespaceTestControl3423{publicpartialclassWindow2:Window

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# - Windows Phone 8.1 (WinRT) : Custom Looping Selector

我想要为我的WindowsPhone8.1(WinRT)使用自定义循环选择器,目前我找不到任何解决方案。我想要这样的东西:WindowsPhoneToolkit适用于WP8.0和WP8.1Silverlight,不适用于WP8.1(WinRT)应用程序(thisquestion适用于WP8.1Silverlight)。有DatePicker&TimePickerWP8.1的控件。有没有什么方法可以自定义他们的数据或用什么方法来欺骗控件来解决我的问题?有一个LoopingSelector类,但它似乎还没有实现。任何解决方案或想法将不胜感激。 最佳答案

c# - 如何设置具有多个值以及单个 w/custom 属性的 ExportMetaData?

我在我的类上设置了以下ExportMetaData属性:[Export(typeof(IDocumentViewer))][ExportMetadata("Name","MyViewer")][ExportMetadata("SupportsEditing",true)][ExportMetadata("Formats",DocFormat.DOC,IsMultiple=true)][ExportMetadata("Formats",DocFormat.DOCX,IsMultiple=true)][ExportMetadata("Formats",DocFormat.RTF,IsMul

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# - ASP.net Web API : change class name when serializing

我有一个产品的数据传输对象类publicclassProductDTO{publicGuidId{get;set;}publicstringName{get;set;}//Otherproperties}当Asp.net序列化JSON(使用JSON.NET)或XML中的对象时,它会生成ProductDTO对象。但是,我想在序列化期间更改名称,从ProductDTO到Product,使用某种属性:[Name("Product")]publicclassProductDTO{[Name("ProductId")]publicGuidId{get;set;}publicstringName{

c# - 低级差异 : non-static class with static method vs. 静态类与静态方法

我想知道使用具有静态方法的非静态类与具有相同静态方法的静态类的一般好处(或缺点)是什么,除了我不能使用非静态类中的静态方法作为扩展方法。例如:classNonStaticClass{publicstaticstringGetData(){return"Thiswasinvokedfromanon-staticclass.";}}与此相比:staticclassStaticClass{publicstaticstringGetData(){return"Thiswasinvokedfromastaticclass.";}}使用一种方法优于另一种方法对性能/内存有何影响?注意:假设我不需要

c# - 使用 Assembly.GetType ("MyCompany.Class1.Class2") 返回 null

我正在尝试使用Assembly.GetType("MyCompany.Class1.Class2")从字符串中动态获取类型。Assembly.GetType("MyCompany.Class1");按预期工作。如果我将一个类嵌入到另一个类中,例如:namespaceMyCompany{publicclassClass1{//.....publicclassClass2{//.....}}}并尝试获取类型Class2Assembly.GetType("MyCompany.Class1.Class2")将返回一个空值。我正在使用.NETFrameworks3.5SP1有谁知道我做错了什么以