.net

Why is Application.Restart() not reliable?

Using the Method Application.Restart() in C# should restart the current Application: but it seems that this is not always working. Is there a reason for this Issue, can somebody tell me, why it doesn't work all the time? ...

Differences between MSIL and Java bytecode?

I'm new to .Net and I'm trying to understand the basics first. What is the difference between MSIL and Java bytecode? ...

What's the best way to send a file over a network using C#?

Can anyone point me to a tutorial on the best way to open a connection from client to server, read in a binary file and send its contents reliably across the network connection? Even better, is there an open source library that already does this that I could refer to? Thanks! ...

Is there any benefit to using Cocoa's version of MVC with .NET?

There's a diagram depicting the difference between traditional MVC and Cocoa MVC here: Cocoa Design Patterns: The Model-View-Controller Design Pattern Are there any benefits of doing it the "Cocoa" way in .NET using Visual Studio? ...

How to build a 64-bit .NET DLL, with 64-bit COM interop?

I need to build a managed DLL, targeted for x64, and expose it via x64 COM. I need a walk through, good article, etc... Interop is fairly straightforward, but when you talk about x64 on both sides, I can't find anything. ...

Client View of Everyone Looking at a Webpage

First let me say that I really feel directionless on this question. I am using windows integrated security, and I can use vb.net to look up information about a user from AD. I also have other information about users I can look up from a MS SQL 2005 server by getting the logon identity name. What I would like to do is display information...

Find a private field with Reflection?

Given this class class Foo { // Want to find _bar with reflection [SomeAttribute] private string _bar; public string BigBar { get { return this._bar; } } } I want to find the private item _bar that I will mark with a attribute. Is that possible? I have done this with properties where I have looked ...

Do access modifiers affect reflection also?

I always believe they did, but seeing some answers here make me doubt... Can I access private fields/properties/methods from outside a class through reflection? ...

Is is possible to convert C# double[,,] array to double[] without making a copy

I have huge 3D arrays of numbers in my .NET application. I need to convert them to a 1D array to pass it to a COM library. Is there a way to convert the array without making a copy of all the data? I can do the conversion like this, but then I use twice the ammount of memory which is an issue in my application: double[] result = new ...

Temporarily load SSL Client Key for Client Authentication in C#

I am using the WebBrowser control to add a WebInterface to C# app. My desire is to verify that only such app is able to connect to our Web server using SSL client certificates. My idea was to embed the client certificate in the app and just use when connecting via my app. Anybody have a sugestion on how to do this? Or the only way to ma...

Visual Studio: Detecting unneeded Assemblies

On larger and/or long running projects, I tend to reference many assemblies and namespaces, and often I end up removing some functionality later on or moving it into a different project. I just wonder, is there a way to check every project (heck, every .cs file) in my whole Visual Studio solution and get a list of all referenced Assembl...

How do you get the root namespace of an assembly?

Given an instance of System.Reflection.Assembly. ...

Best Approach For Configuring Multiple .Net Applications

We have a suite of interlinked .Net 3.5 applications. Some are web sites, some are web services, and some are windows applications. Each app currently has its own configuration file (app.config or web.config), and currently there are some duplicate keys across the config files (which at the moment are kept in sync manually) as multiple a...

How can I tell how many SQL Connections I have open in a windows service?

I'm seeing some errors that would indicate a "connection leak". That is, connections that were not closed properly and the pool is running out. So, how do I go about instrumenting this to see exactly how many are open at a given time? ...

Change ContextMenu Font Size in C#

Is it possible to change the font size used in a ContextMenu using the .NET Framework 3.5 and C# for a desktop application? It seems it's a system-wide setting, but I would like to change it only within my application. ...

Is there an elegant way to instantiate a variable type with parameters?

This isn't legal: public class MyBaseClass { public MyBaseClass() {} public MyBaseClass(object arg) {} } public void ThisIsANoNo<T>() where T : MyBaseClass { T foo = new T("whoops!"); } In order to do this, you have to do some reflection on the type object for T or you have to use Activator.CreateInstance. Both are pretty nas...

How to scroll only the right side of a table, listview, or datagrid?

Let's say I have data structures that're something like this: Public Class AttendenceRecord Public CourseDate As Date Public StudentsInAttendence As Integer End Class Public Class Course Public Name As String Public CourseID As String Public Attendance As List(Of AttendenceRecord) End Class And I want a table that looks som...

How to prevent others from using my .Net assembly?

I have an assembly which should not be used by any application other than the designated executable. Please give me some instructions to do so. ...

Problems with Visual Studio Express installation

I just installed 'Visual C# 2008 Express Edition' and 'Visual Web Developer 2008 Express Edition' on my Vista machine. Previously I have been running these in Win XP. When launching the software, starting a new project and trying to build it I get warnings like "The referenced component 'System' could not be found."; one row for each nam...

How do I remove the .NET Compact Framework from my Windows Mobile 5 device?

I'm trying to get a number of third party applications to work on my Windows Mobile 5 smartphone. I've installed the latest version (3.5) of the Microsoft.NET Compact Framework, but whenever I run the apps I get an error message which states: "This application [Application Name] requires a newer version of the Microsoft .NET Compact Fra...