.net

What is the character that represents a null byte after ASCIIEncoding.GetString(byte[])?

I have a byte array that may or may not have null bytes at the end of it. After converting it to a string I have a bunch of blank space at the end. I tried using Trim() to get rid of it, but it doesn't work. How can I remove all the blank space at the end of the string after converting the byte array? I am writing this is C#. ...

Class.Class vs Namespace.Class for top level general use class libraries?

Which one is more acceptable (best-practice)?: namespace NP public static class IO public static class Xml ... // extension methods using NP; IO.GetAvailableResources (); vs public static class NP public static class IO public static class Xml ... // extension methods NP.IO.GetAvailableResources (); Also ...

How to write Performance Test for .Net application?

How to write Performance Test for .Net application? Does nUnit or any other Testing framework provides framework for this? Edit: I have to measure performance of WCF Service. ...

Using .NET XmlSerializer with get properties and setter functions

I'm trying to use XmlSerializer from C# to save out a class that has some values that are read by properties (the code being just a simple retrieval of field value) but set by setter functions (since there is a delegate called if the value changes). What I'm currently doing is this sort of thing. The intended use is to use the InT prop...

IList<T> versus Collection<T> as property

I have a class with a internal array field. I want to expose this array as a property, such that it maintains as much funtionallity of the orginal array but does not violate encapsulation by exposing the array directly. What are the various methods and pros and cons? I'm thinking specifically about IList<T> or Colleciton<T> ...

How do you mark class with TypeConverter that is not in referenced solution?

I have a class that I've written a TypeConverter for. I want to keep the TypeConverter separate from the main solution, as it is only needed at design time and have an extensibility project now that contains the TypeConverter. Thus, when I deploy, I don't need to deploy the extensibility assembly at all. However, I can't figure out the ...

VB.Net equivalent of C# "As"

What is the equivalent in VB.Net of the C# As keyword, as in var x = y as String; if (x == null) ... ...

Set global hotkeys using C#

I need to capture a key press when my program is not in focus. (ie. Ctrl+Alt+J) and trigger an event in my program. Thus far i have found this dll that appears to be the corrrect path" [DllImport("user32.dll")]private static extern int RegisterHotKey(IntPtr hwnd, int id,int fsModifiers, int vk); [DllImport("user32.dll")] private stati...

Programmatically setting Absolute URL inside image controls for .NET Facebook Application

The goal is to allow a function to be called from within an ASPX imagebutton control that is used as part of a form. The need for an absolute URL is that Facebook Canvas applications require them. So the rendered control should look something like <input type="image" src="http://myURL.com/images/submit.gif" /> The ASPX markup might be ...

Java Equivalent to .NET's DateTime.Parse?

I'm working on a java class that I will use with Pervasive Data Profiler that needs to check if a Date String will work with .NET's DateTime.Parse. Is there an equivalent class or 3rd party library that can give me this functionality that is very close to .NET's DateTime.Parse? I would need it to be able to handle a broad range of date...

.NET threading question

Is there any essential difference between this code: ThreadStart starter = new ThreadStart(SomeMethod); starter.Invoke(); and this? ThreadStart starter = new ThreadStart(SomeMethod); Thread th = new Thread(starter); th.Start(); Or does the first invoke the method on the current thread while the second invokes it on a new thread? ...

Connection to embedded device with Windows and .Net

I am building a .net application(xp, vista, 7) that will communicate with an embedded device. I will be able to connect via IP, serial port and modem. Question: Should I allow some type of open connection within my application that will allow me to connect to the device through some other channels that may be set up in the operating syst...

Can CPython speak with WCF?

I would like to write a CPython app that would consume WCF services that use NetNamedPipeBinding and NetTcpBinding. It is possible? What library enables that? ...

Looking for some good GUI testing frameworks/gui automation test tools for Windows Forms .NET

Hello, I am looking for a good GUI testing framework/automation testing tool for windows forms based apps. Can you recommend any ? ...

Can a Java portlet be embedded in an ASP.NET page?

We have some portlets created by a team working on a JEE site. They would like to include one of these portlets within a site I manage, which is ASP.NET. Aside from solutions like iframes, is it possible to embed a Java portlet within an ASP.NET page? (Note: I don't have much Java/portlet experience, so please take that into considera...

Problems doing asynch operations in C# using Mutex.

I've tried this MANY ways, here is the current iteration. I think I've just implemented this all wrong. What I'm trying to accomplish is to treat this Asynch result in such a way that until it returns AND I finish with my add-thumbnail call, I will not request another call to imageProvider.BeginGetImage. To Clarify, my question is two...

Why doesn't the conditional operator correctly allow the use of "null" for assignment to nullable types?

Possible Duplicates: Nullable types and the ternary operator. Why wont this work? Conditional operator assignment with nullable<value> types? This will not compile, stating "Type of conditional expression cannot be determined because there is no implicit conversion between 'System.DateTime' and ''" task.ActualEndDate = Text...

Windows - CPU power management APIs

What APIs are provided by Windows for CPU power management (I'm interested in CPU frequency scaling, setting min and max CPU frequency - similar to what you can do in Control Panel in power plans, but in a programmatic way). I'm also interested in .Net APIs. (It is not something I intend to use in a production environment, but rather as ...

How to seralize only some properties in .Net?

This is for a web project so i have several classes that inherit from Web.UI. I only want to serialize very particular properties (basically, only local properties) I'm aware of the XMLIgnore property that can be placed on a property to ignore items, but this won't work in my context since that would require modifying a bunch of stuff ...

When should I deploy my assemblies into the GAC?

I would like to know practically what kind of Assemblies should I deploy in GAC. Case 1. If in my Solution multiple project uses log4net.dll then should it be deployed in GAC? Case 2. If I have multiple application deployed in a machine each using log4net.dll is this the reason enough to deploy log4net.dll into GAC? ...