Tag: C#的

在Web应用程序中configurationLog4Net

我有这个代码和下面的configuration文件: ILog log = LogManager.GetLogger(typeof(MyClass)); log.Debug("Testing"); TestProj目录不创build,如果我创build它,没有TestLog.txt文件,没有日志…什么都没有。 任何想法? 谢谢, configuration文件 <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> <log4net debug="true"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="C:\\TestProj\\TestLog.txt" /> <appendToFile value="true" /> <rollingStyle value="Size" /> <maxSizeRollBackups value="10" /> <maximumFileSize value="10MB" /> <staticLogFileName value="true" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M – %m%n" /> </layout> </appender> <root> <level value="DEBUG" /> […]

如何在Visual Studio中closures括号/引号自动完成

正如它在标题中所述:如何closuresMSVS中的括号/引号/大括号自动完成? 我主要对C#和XAML感兴趣,但是在文本编辑器上也不错。 编辑 :目前我正在使用这些扩展MSVS 11: AnkhSVN的 并发可视化器 PreEmptive Analytics聚合器展示台 MSVS PerfWatson VsGraphicsDebuggerPkg Web工具扩展 他们中的大多数预安装了msvs安装,因为我不记得安装它们;) 编辑2 :我在这个版本中使用msvs:版本11.0.50323.1 QRELB 编辑3 : 我发现这个问题在当前可用的msvs11中不会发生。

C ++中是否有“字节”数据types?

如果存在包含头文件? 此代码给编译错误: #include <iostream> using namespace std; int main() { byte b = 2; cout << b << endl; return 0; }

在Visual Studio中KeyDown事件,KeyPress事件和KeyUp事件之间的区别

任何人都可以告诉我的KeyDown事件, KeyPress事件和KeyUp事件之间的区别? 我检查了msdn网站,并没有解释太多。 任何人都可以用简单的逻辑来告诉我什么时候发生的每一件事情? 我觉得所有上述事件发生在按下某个键时。 那么它们之间的确切区别是什么?

使用LINQ扩展方法的多个WHERE子句

我有一个LINQ查询,如下所示: DateTime today = DateTime.UtcNow; var results = from order in context.Orders where ((order.OrderDate <= today) && (today <= order.OrderDate)) select order; 我正在学习/理解LINQ。 在某些情况下,我需要添加两个额外的WHERE子句。 为了做到这一点,我正在使用: if (useAdditionalClauses) { results = results.Where(o => o.OrderStatus == OrderStatus.Open) // Now I'm stuck. } 正如你所看到的,我知道如何添加一个额外的WHERE子句。 但是,我如何添加多个? 例如,我想补充一点 WHERE o.OrderStatus == OrderStatus.Open AND o.CustomerID == customerID 到我以前的查询。 我如何使用扩展方法做到这一点? 谢谢!

命名空间的多个别名?

是否有可能有一个名称空间的所有声明多个其他名称空间? 喜欢这个: namespace std {…}; namespace glm {…}; namespace mynamespace = std; //mynamespace is an alias for std namespace mynamespace += glm; //mynamespace will hold glm functions as well.

从C#打印堆栈跟踪信息

作为我们产品中某些error handling的一部分,我们想转储一些堆栈跟踪信息。 然而,我们体验到,许多用户只是截取错误消息对话框的屏幕截图,而不是向我们发送程序中提供的完整报告的副本,因此我想在此对话框中提供一些最小的堆栈跟踪信息。 我的机器上的.NET堆栈跟踪如下所示: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) at […]

删除所有DataGrid行和单元格边框

我想隐藏(或删除)我的数据网格中的所有行(和随后的单元格)的所有边界,认为一个基本的HTML表格 。 我已经看遍了,大多数问题似乎是关于造型而不是隐藏它们。 我已经试过像这样设置BorderBrush和BorderThickness: <DataGrid.RowStyle> <Style TargetType="DataGridRow"> <Setter Property="BorderBrush" Value="Transparent" /> <Setter Property="BorderThickness" Value="0" /> </Style> </DataGrid.RowStyle> 尝试了CellStyle一样,但没有骰子,仍然看到边界。

将PEM转换为PPK文件格式

是否有内置的C#机制将PEM文件转换为PPK文件? (您可能会猜测Amazon EC2为我提供了一个PEM文件,而且我需要使用PPK格式进行SSH连接)。

数据源不支持服务器端数据分页

我的屏幕上有一个GridView,需要它来允许分页。 标记: <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataSourceID="ObjectDataSource1"> <Columns> <asp:BoundField DataField="appID" HeaderText="appID" SortExpression="appID" /> </Columns> </asp:GridView> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetBookingId" TypeName="AppointmentRepository"> <SelectParameters> <asp:Parameter Name="maximumRows" Type="Int32" /> <asp:Parameter Name="startRowIndex" Type="Int32" /> </SelectParameters> </asp:ObjectDataSource> 代码隐藏: ObjectDataSource1.SelectParameters["maximumRows"].DefaultValue = "10"; ObjectDataSource1.SelectParameters["startRowIndex"].DefaultValue = "0"; LINQ查询: public IQueryable<tblAppointment> GetBookingId(int maximumRows, int startRowIndex) { var result = (FROM a IN dc.tblAppointments SELECT […]