.net-2.0

New Added Types in .NET Framework 2.0 Service Pack 1

懵懂的女人 提交于 2020-01-02 05:56:14
问题 I assumed there were only bug fixes/(no new types) in .NET 2.0 SP1 until I came across few posts which were mentioning DateTimeOffset structure, that was added in .NET 2.0 SP1. Is there a full listing of the newly added types in .NET 2.0 SP1? 回答1: Here's what you're looking for: Full Article: http://www.hanselman.com/blog/CatchingRedBitsDifferencesInNET20AndNET20SP1.aspx This may also be helpful: Full Article: http://www.hanselman.com/blog/ChangesInTheNETBCLBetween20And35.aspx 回答2: There were

App is unable to write to the registry, even though the user has administrative privileges

拜拜、爱过 提交于 2020-01-02 04:39:10
问题 I am using Visual Studio 2010, and I'm writing a program that needs to set (and read) new registry values under HKLM\Software\myapp The program is .NET 2.0-based and as for now it runs on Windows 7 64-bit. Here is my ocde: RegistryKey softwareKey = Registry.LocalMachine.OpenSubKey("Software", true); RegistryKey MyKey = softwareKey.CreateSubKey("MyApp"); RegistryKey = MyKey.CreateSubKey("MyKey"); selfPlacingWindowKey.SetValue("instaldateperson", datestr + usrname); The problem I have when

How do you tell if a Windows Form is open but behind another window?

℡╲_俬逩灬. 提交于 2020-01-02 04:20:26
问题 Calling Form.Visible will return true regardless of whether the form is maximized, minimized, or has a FormWindowState of Normal. What I want to know is how to tell if the form is open but "hidden" behind another application's window. If that's the case, I want to bring it to the front and actually make it visible to the user. I tried the BringToFront() method but it didn't work. I also tried calling the Show() method but if the form is behind another application's window, it remains that way

How to distinguish the server version from the client version of Windows?

冷暖自知 提交于 2020-01-02 03:49:05
问题 How to distinguish the server version from the client version of Windows? Example: XP, Vista, 7 vs Win2003, Win2008. UPD: Need a method such as bool IsServerVersion() { return ...; } 回答1: Ok, Alex, it looks like you can use WMI to find this out: using System.Management; public bool IsServerVersion() { var productType = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem") .Get().OfType<ManagementObject>() .Select(o => (uint)o.GetPropertyValue("ProductType")).First(); //

How to resolve XSL includes in a Transformation that loads XSL from a String?

不羁岁月 提交于 2020-01-02 03:17:26
问题 .NET 2.0/VS2005 I am trying to use the XslCompiledTransform class to perform a XSL Transformation. I have two XSL files, the first of which includes a reference to the other in the form of an <xsl:include> statement : Main.xsl: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:include href="Included.xsl" /> ... ... </xsl:stylesheet> Now, If I could load the "Main.xsl" file itself as a URI, my transformation code would be as simple as : // This is a function

Looking for a Visual Studio toolbox style navigation for desktop applications

↘锁芯ラ 提交于 2020-01-01 19:51:11
问题 I'm working on a project that uses an MDI application with a navigation panel on the side. Currently it is a ListView. However, I would like to redesign it to be similar to the toolbox in visual studio 2008. If this is something that would require overriding the default paint method, it would also help if you could provide some good references on how to work with the paint method as I do not currently have any experience using it. Thanks in advance. 回答1: You want to be using a ToolBox control

.NET2.0 C# Interop: How to call COM code from C#?

∥☆過路亽.° 提交于 2020-01-01 14:23:12
问题 In my last development environment, I was able to easily interact with COM, calling methods on COM objects. Here is the original code, translated into C# style code (to mask the original language): public static void SpawnIEWithSource(String szSourceHTML) { OleVariant ie; //IWebBrowser2 OleVariant ie = new InternetExplorer(); ie.Navigate2("about:blank"); OleVariant webDocument = ie.Document; webDocument.Write(szSourceHTML); webDocument.close; ie.Visible = True; } Now begins the tedious,

In IL code, why is there not a nop opcode in a given situation? Why is there a br.s opcode in a given situation?

早过忘川 提交于 2020-01-01 09:17:16
问题 Suppose I have the following code: public class Class1 { private Class2 obj; public void MethodA() { var class2 = new Class2(); class2.PropertyI = 2; obj = MethodB(class2); } public Class2 MethodB(Class2 class2) { return class2; } } public class Class2 { public int PropertyI { get; set; } } The generated IL code from compiling with Visual Studio 2010 as a .NET 2.0 assembly is the following: .method public hidebysig instance void MethodA() cil managed { .maxstack 3 .locals init ( [0] class

How does default/relative path resolution work in .NET?

做~自己de王妃 提交于 2020-01-01 03:12:07
问题 So... I used to think that when you accessed a file but specified the name without a path (CAISLog.csv in my case) that .NET would expect the file to reside at the same path as the running .exe. This works when I'm stepping through a solution (C# .NET2.* VS2K5) but when I run the app in normal mode (Started by a Websphere MQ Trigger monitor & running in the background as a network service) instead of accessing the file at the path where the .exe is it's being looked for at C:\WINDOWS\system32

Right way to get username and password from connection string? [duplicate]

半世苍凉 提交于 2019-12-31 19:20:30
问题 This question already has answers here : Get user and password from ConnectionStringSettings (11 answers) Closed 6 years ago . I have a connection string like this: "SERVER=localhost;DATABASE=tree;UID=root;PASSWORD=branch;Min Pool Size = 0;Max Pool Size=200" How do I get the various database parameters out of it? I can get database name and server like this: serverName = conObject.DataSource; dbName = conObject.Database; I need the username and password as well similarly. No property is set