.net-4.0

Why can I create a class named “var”?

限于喜欢 提交于 2019-12-17 15:47:09
问题 Isn't var a keyword in C#? But why can I do this: public class var { } public class main { public static void main(string[] args) { var testVar = new var(); } } The var that is used in the code is the var class that is declared before the main class. And the compiler doesn't even complain. While when I do this: public class int { } or this: public class true { } The compiler said that int or true is a keyword and cannot be used like that. Why is it not the same with var ? 回答1: var is not a

Reverse a string with accent chars?

谁都会走 提交于 2019-12-17 15:35:02
问题 So I saw Jon's skeet video and there was a code sample : There should have been a problem with the é - after reversing but I guess it fails on .net2 (IMHO), anyway it did work for me and I did see the correct reversed string. char[] a="Les Misérables".ToCharArray(); Array.Reverse(a); string n= new string(a); Console.WriteLine (n); //selbarésiM seL But I took it further: In Hebrew there is the "Alef" char : א and I can add punctuation like : אֳ ( which I believe consists of 2 chars - yet

How do I use GZipStream with System.IO.MemoryStream?

血红的双手。 提交于 2019-12-17 15:34:40
问题 I am having an issue with this test function where I take an in memory string, compress it, and decompress it. The compression works great, but I can't seem to get the decompression to work. //Compress System.IO.MemoryStream outStream = new System.IO.MemoryStream(); GZipStream tinyStream = new GZipStream(outStream, CompressionMode.Compress); mStream.Position = 0; mStream.CopyTo(tinyStream); //Decompress outStream.Position = 0; GZipStream bigStream = new GZipStream(outStream, CompressionMode

.NET 4.0 build issues on CI server

六眼飞鱼酱① 提交于 2019-12-17 15:18:47
问题 Anybody manage to get .NET 4.0 applications compiling on a CI server without installing Visual Studio 2010 on a CI server? No SDK exists for .NET 4.0. Have installed .NET 4.0 on CI Server. Msbuild.exe works for simple projects and give the following warning: (GetReferenceAssemblyPaths target) -> C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(847,9): warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.0" were not found. To resolve this,

Do you need both .net 3.5 and 4.0 installed or just .net 4?

百般思念 提交于 2019-12-17 11:21:08
问题 to run both 3.5 and 4.0 web apps? 回答1: I remember reading something once from Microsoft that stated: ".NET 4.0 adds in-process side-by-side compatibility with earlier versions of the Framework. This feature allows an application process to simultaneously run part of its code using the .NET Common Language Runtime (CLR) 4 and other parts using older versions of the CLR." So to answer your question you only need both if your application uses features from both or altenatively you have separate

.NET 4.0 - CultureNotFoundException

扶醉桌前 提交于 2019-12-17 11:15:13
问题 I have migrated my ASP.NET MVC 2 project to VS 2010 + .NET 4.0. Now when i start the application i get a lot of "CultureNotFoundException" in IntelliTrace and Output/Gebug window : A first chance exception of type 'System.Globalization.CultureNotFoundException' occurred in mscorlib.dll I know what "A first chance exception" means, but when i try to debug(added "CultureNotFoundException" into Bebug/Exceptions[Thrown]) why ex. is thrown i got this detailed exception text: System.Globalization

MSBUILDEMITSOLUTION not working with .NET 4?

天大地大妈咪最大 提交于 2019-12-17 10:59:29
问题 In prior versions of MSBuild, you could set an environment variable named MSBUILDEMITSOLUTION to 1 to get an XML version of a solution (.sln) file that could be parsed. According to the MSBuild Team Blog, that's still in the version that ships with Visual Studio 2010, but it does not seem to be working. Has anyone managed to get this working with MSBuild 4.0? If so, what is required? (We use this to find and run convention-based unit tests with an NAnt script.) 回答1: Set MSBuildEmitSolution=1

Where can I find a TPL dataflow version for 4.0?

走远了吗. 提交于 2019-12-17 09:48:09
问题 I am looking for the .NET 4.0 version of the TPL dataflow library. The Nuget package has a 4.0 version of the library, but it seems to target .NET 4.5. I found various references to a 4.0 version, like in this forum: http://social.msdn.microsoft.com/Forums/en-US/tpldataflow/thread/6206c714-6dee-4d17-a880-26d0c137a167 But the link mentioned just redirects me to the Nuget page of the library. Does anyone know where I can find a working version that targets .NET 4.0? 回答1: I wrote Steve from the

Where is the .NET Framework Global Assembly Cache?

久未见 提交于 2019-12-17 09:10:12
问题 I installed the VS2010 and .NET 4.0, then I compiled an assembly and ran the gacutil using the exe available on %ProgramFiles%\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools The output of the executable said the assembly was sucessfully installed on Global Assembly Cache. However, when I go to %WINDIR%\assembly folder I cannot find the assembly I installed using the .NET Framework 4.0 gacutil . I've seen some posts saying the .NET Framework 4.0 has a separated GAC, but what I haven't found

How to send a custom command to a .NET windows Service from .NET code?

北慕城南 提交于 2019-12-17 08:21:33
问题 As in the following link, one can stop, start, and "stop, then start" a service using C# code. http://www.csharp-examples.net/restart-windows-service/ I have baked a .NET service that does implement OnStart and OnStop . However, I need to implement a "smart restart" functionality which is more involved than just stopping and then starting. I need to keep the downtime to just a few seconds if that (but Stop + Start can take minutes in this case when done cleanly, and I must do it cleanly), and