Tag: C#的

registerNatives()方法做了什么?

在java中,Object类的私有静态方法registerNatives()是做什么的?

左移,负移位数

到底发生了什么? a << -5 显然它不会右移。 但是我正在读的这本书说: 在一台机器上,这个expression式实际上做了27位的左移 我的问题是 为什么? 是什么导致了27位的左移? 当转移负移位数时究竟发生了什么? 谢谢。

迂回gcc警告:函数返回types的types限定符

当我第一次使用GCC 4.3编译我的C ++代码(编译成功之后, -Wall -Wextra没有带-Wall -Wextra选项的警告),我突然间发现了一堆forms为warning: type qualifiers ignored on function return type的错误warning: type qualifiers ignored on function return type 。 考虑temp.cpp : class Something { public: const int getConstThing() const { return _cMyInt; } const int getNonconstThing() const { return _myInt; } const int& getConstReference() const { return _myInt; } int& getNonconstReference() { return […]

.Net正则expression式:什么是字符\ w?

简单的问题: c# \w net中字符\w的模式是什么? 我首先想到的是它匹配[A-Za-z0-9_] , 文档告诉我: 字符类描述模式匹配 \ w匹配\ w“我”,“D”,“A”,“1”,“3” 单词字符。 在“ID A1.3” 这不是很有帮助。 而且\w似乎与äöü相匹配。 还有什么? 有更好的(确切的)定义吗?

C ++向量的insert&push_back差异

我想知道vector的push_back和insert函数有什么区别。 是否有结构上的差异? 是否有非常大的性能差异?

generics方法存储在哪里?

我已经阅读了一些有关generics的信息,并注意到一件有趣的事情。 例如,如果我有一个generics类: class Foo<T> { public static int Counter; } Console.WriteLine(++Foo<int>.Counter); //1 Console.WriteLine(++Foo<string>.Counter); //1 在运行时,两个类Foo<int>和Foo<string>是不同的。 但是具有generics方法的非generics类的情况呢? class Foo { public void Bar<T>() { } } 很显然,只有一个Foo类。 但是方法Bar呢? 所有通用的类和方法都在运行时用它们使用的参数closures。 这是否意味着Foo类有很多Bar实现,并且这个方法的信息存储在内存中?

重置一个stringstream

如何将stringstream的状态“重置”到创build时的状态? int firstValue = 1; int secondValue = 2; std::wstringstream ss; ss << "Hello: " << firstValue; std::wstring firstText(ss.str()); //print the value of firstText here //How do I "reset" the stringstream here? //I would like it behave as if I had created // stringstream ss2 and used it below. ss << "Bye: " << secondValue; […]

如何获得向量中的最大(或最小)值?

我怎样才能得到最大(或最小)的值在一个向量在C + + ? 我在Google上看到了一些这样的解决scheme,但没有一个对我有意义:( 有人可以用简单的noob方式解释如何从vector中获得最大值或最小值吗? 我是否错误地认为它会和数组差不多呢? 我需要一个迭代器吗? 我尝试了max_element但不断收到错误? vector<int>::const_iterator it; it = max_element(cloud.begin(), cloud.end()); 错误:请求“云”中的成员“开始”,这是非类types“int [10]” 编辑:我无法回答我自己? 所以我把它放在这里 哇,谢谢你的回复! 我结束了这样做,认为它好吗? for (unsigned int i = 0; i < cdf.size(); i++) if (cdf[i] < cdfMin) cdfMin = cdf[i]; 其中cdf是一个向量。

Visual Studio 2013或2015 EditorPackage没有正确加载正确

当启动Visual Studio 2013 Pro(安装Update 4)时,我经常在过去的两周左右得到这个错误信息(一天几次) “Microsoft.VisualStudio.Editor.Implementation.EditorPackage”包没有正确加载。 我知道我可以通过closuresVisual Studio并删除: %LocalAppData%\Microsoft\VisualStudio\12.0\ComponentModelCache 在那之前我从来没有见过,就我在互联网上发现的情况而言,它可能是在Update 3中引入的。 那么,问题是每天重启几次Visual Studio是很烦人的,我想知道是否有其他人遇到这种情况,知道如何解决这个问题,或者是什么原因。 我注意到,如果我并行处理多个Visual Studio实例,它经常发生。 这是一个杀手。 但是我仍然怀疑涉及第三方组件,或者是其中一个解决scheme的规模(大约70个项目)。 我试图停用一些我新安装的扩展,需要大项目,但无济于事。 就像信息:我正在使用C# 。 当与在Visual Studio的几个实例中打开的项目并行工作时,我从来没有遇到过任何问题。 有没有人有这个扩展相同的问题,或者可能有一个比删除文件夹和重新启动更好的解决scheme?

你如何debuggingMVC 4 API路线最好?

我有一个WP7游戏,使用RESTsharp与我的MVC4 RESTful服务器进行通信,但我经常遇到问题,使请求工作,因此我想debugging失败的地方。 这是一个例子,我的GameController上的构造GameController被击中,但Post方法没有被击中,我不明白为什么。 客户代码: public void JoinRandomGame() { client = new RestClient { CookieContainer = new CookieContainer(), BaseUrl = "http://localhost:21688/api/", }; client.Authenticator = GetAuth(); RestRequest request = new RestRequest(Method.POST) { RequestFormat = DataFormat.Json, Resource = "game/" }; client.PostAsync(request, (response, ds) => {}); } 服务器代码: public void Post(int id) { if (ControllerContext.Request.Headers.Authorization == null) { //No […]