Tag: C#的

使用匿名枚举

匿名enum声明的目的是什么,例如: enum { color = 1 }; 为什么不只是声明int color = 1 ?

静态字段究竟如何在内部工作?

假如你有一堂课, class Foo { public static bar; } 当你说: new Foo(); 我可以想象,在内存中,为这个对象保留一个空间。 …当你再说一遍: new Foo(); …现在你有另一个空间可用的对象。 但是,静态字段究竟在哪里? 我真正想学的是: 对象的引用如何引用它们引用的对象的同一个字段?

CLion在哪里存储可执行文件?

我在Ubuntu 14.04上安装CLion。 我用CMakeLists.txt的帮助来构build我的第一个项目: 源文件: #include <iostream> using namespace std; int main() { cout << "Hello, World!" << endl; return 0; } 的CMakeLists.txt: cmake_minimum_required(VERSION 2.8.4) project(sh) set(SOURCE_FILES main.cpp) add_executable(sh ${SOURCE_FILES}) 我的源文件位于/ home / user / Desktop / sh 。 但生成后,我没有看到这个文件夹中的任何可执行文件。 它在哪里?

IIS错误502.5上的ASP.NET Core 1.0

我刚刚将我的服务器(Windows 2012R2)更新为.Net Core 1.0 RTM Windows Hosting软件包,来自以前的.Net Core 1.0 RC2 。 我的应用程序在我的电脑上工作,没有任何问题,但服务器不断显示 HTTP Error 502.5 – Process Failure Common causes of this issue: The application process failed to start The application process started but then stopped The application process started but failed to listen on the configured port 它以前使用RC2版本。 不知道会发生什么问题。 这是所有事件查看器说: Failed to start process […]

在C ++中增加 – 何时使用x ++或++ x?

我目前正在学习C ++,而前一段时间我也学习了这个增量。 我知道你可以使用“++ x”来使之前的增量和“x ++”来完成。 不过,我真的不知道什么时候使用这两种…我从来没有真正使用过“++ x”,而且到目前为止,事情一直很好 – 所以,我应该什么时候使用它? 例如:在for循环中,何时最好使用“++ x”? 另外,有人可以解释不同的增量(或递减)是如何工作的? 我真的很感激。

如何格式化string使用printf()在输出中获得相等的长度?

我有两个函数,一个产生消息,如Starting initialization…和另一个检查返回码和输出"Ok" , "Warning"或"Error" 。 但是,产生的输出具有不同的长度: Starting initialization…Ok. Checking init scripts…Ok. 我怎样才能得到这样的东西: Starting initialization… Ok. Checking init scripts… Ok.

LPARAM和WPARAM的定义是什么?

我知道我在这里偷懒,我应该为自己拖拽头文件,但是LPARAM和WPARAM参数的实际types是什么? 他们是指针,还是四字节整数? 我正在做一些C#互操作代码,并希望确保我能在x64系统上工作。

从WPF DataGrid复制粘贴数据时,OpenClipboard失败

我有一个使用数据网格的WPF应用程序。 应用程序工作正常,直到我安装了Visual Studio 2012和Blend + SketchFlow预览。 现在,当我试图从Ctrl + C (在任何应用程序中)将网格中的数据复制到剪贴板中时,出现以下exception: System.Runtime.InteropServices.COMException (0x800401D0): OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN)) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode, IntPtr errorInfo) at System.Windows.Clipboard.Flush() at System.Windows.Clipboard.CriticalSetDataObject(Object data, Boolean copy) at System.Windows.Controls.DataGrid.OnExecutedCopy(ExecutedRoutedEventArgs args) at System.Windows.Controls.DataGrid.OnExecutedCopy(Object target, ExecutedRoutedEventArgs args) at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e) at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding […]

在C ++中转换matrix的最快方法是什么?

我有一个matrix(比较大),我需要转置。 例如,假设我的matrix是 abcdef ghijkl mnopqr 我想要的结果如下: agm bhn c I o djp ekq flr 什么是最快的方法来做到这一点?

我怎么能将数据从string转换为长在C#

我怎么能将数据从string转换为长在C#中? 我有数据 String strValue[i] ="1100.25"; 现在我想要它 long l1;