草庐IT

source-sets

全部标签

c# - 使用 : HandleRef or IntPtr (newer source code from Microsoft no longer uses HandleRef) 哪个更好/更安全

例如,在旧的.NETFramework2.0源代码(Windows窗体、VisualStudio2005-Whidbey)中,GetClientRect函数是使用HandleRef定义的:[DllImport(ExternDll.User32,ExactSpelling=true,CharSet=CharSet.Auto)]publicstaticexternboolGetClientRect(HandleRefhWnd,[In,Out]refNativeMethods.RECTrect);在新的WindowsAPI代码包(来自Microsoft,2009/2010)中,使用IntPt

c# - Properties.Settings.Default.Save(); ->那个文件在哪里

我有一个使用“设置”的应用。要保存我使用的设置:Properties.Settings.Default.Save();阅读我使用的:Properties.Settings.Default.MyCustomSetting;在我的应用程序文件夹中,我只有exe文件。没有配置文件。我的应用程序运行良好,可以读写设置。如果该文件不在应用程序文件夹中,该文件位于何处? 最佳答案 在我的WindowsXP机器上,设置保存在C:\DocumentsandSettings\\ApplicationData\下某处名为user.config的文件中。

c# - 为什么 EPPlus 告诉我 "Can' t set color when patterntype is not set"当我设置了 PatternType 时?

我有这段代码来尝试设置标题行的样式:worksheet.Cells["A32:D32"].Style.Font.Name="Georgia";worksheet.Cells["A32:D32"].Style.Font.Bold=true;worksheet.Cells["A32:D32"].Style.Font.Size=16;worksheet.Cells["A32:D32"].Style.Fill.PatternType=ExcelFillStyle.Solid;worksheet.Cells["A32:D33"].Style.Fill.BackgroundColor.SetCol

c# - 如何在设计时避免 XAML 代码中出现 "object reference not set to an instance of an object"异常?

我自己设计的wpf用户控件有问题。问题是,当我在我的程序中实现用户控件时,在设计时XAML代码中出现objectreferencenotsettoaninstanceofanobject异常。设计师向我展示了以下信息:atMicrosoft.Expression.Platform.InstanceBuilders.InstanceBuilderOperations.InstantiateType(Typetype,BooleansupportInternal)atMicrosoft.Expression.Platform.InstanceBuilders.ClrObjectInstan

c# - 如何为数组数据成员定义 get 和 set?

我正在创建一个类Customer,它具有以下数据成员和属性:privatestringcustomerName;privatedouble[]totalPurchasesLastThreeDays;//arrayof3elementsthatwillholdthetotalsofhowmuchthecustomerpurchasedforthepastthreedaysi.e.element[0]=100,element[1]=50,element[2]=250publicstringCustomerName{get{returncustomerName;}set{customerNa

c# - System.StackOverflowException ,何时使用 get set 属性?

在wcfserviceLibrary.DLL中发生类型为“System.StackOverflowException”的未处理异常代码如下。[DataContract]publicclassmemberdesignations{[DataMember]publicstringDesigId{get{returnDesigId;}set{DesigId=value;}}[DataMember]publicstringDesignationName{get{returnDesignationName;}set{DesignationName=value;}}}然后我有如下的Typememb

c# - 将 set 访问器添加到类中的属性,该类派生自只有一个 get 访问器的抽象类

我有一个抽象类,AbsClass实现一个接口(interface),IClass.IClass有几个属性只有Get访问器。AbsClass实现的属性IClass作为要在派生自的类中定义的抽象属性AbsClass.所以所有派生自的类AbsClass还需要满足IClass通过与Get访问器具有相同的属性。但是,在某些情况下,我希望能够向来自的属性添加set访问器。IClass.然而,如果我尝试覆盖中的抽象属性AbsClass使用setaccessor我收到此错误ConcClassA.Bottom.Set无法覆盖,因为AbsClass.Bottom没有可覆盖的set访问器见ConcClass

c# - Orchard : Full Source or Not?

我们将使用Orchard作为特定客户的基础。我们是一家运行VS2K10的C#商店。我们将按照我们项目的规范将其放入我们的版本控制系统中。也就是说,我们将根据客户的需求创建自定义模块。这里的每个人都推荐什么方法?从CodePlex获取完整源代码并checkin仅下载Orchard网络代码(类似于网络平台安装程序)#1的问题是代码库相当大,但它允许我们在开发时在本地调试站点。#2的注意事项是什么?缺乏调试?我很好奇每个人对此的做法是什么。我倾向于选择#1,获取完整的源代码,将其放入SVN,然后以此为基础进行构建。想法? 最佳答案 如果您

c# - Entity Framework : Setting a Foreign Key Property

我们有一个大致如下所示的表格:CREATETABLELockers{UserIDintNOTNULLPRIMARYKEY(foreignkey),LockerStyleIDint(foreignkey),NameplateIDint(foreignkey)}所有键都与其他表相关,但由于应用程序的分布方式,我们更容易将ID作为参数传递。所以我们想这样做:Lockerl=newLocker{UserID=userID,LockerStyleID=lockerStyleID,NameplateID=nameplateID};entities.AddLocker(l);我们可以在LINQ-to

c# - 如何在 XmlTextWriter 中设置 Settings 属性,以便我可以将每个 XML 属性写在自己的行中?

我有这段代码,它将一个对象序列化为一个文件。我试图让每个XML属性在单独的行上输出。代码如下所示:publicstaticvoidToXMLFile(Objectobj,stringfilePath){XmlSerializerserializer=newXmlSerializer(obj.GetType());XmlWriterSettingssettings=newXmlWriterSettings();settings.NewLineOnAttributes=true;XmlTextWriterwriter=newXmlTextWriter(filePath,Encoding.U