I've tracked a problem I'm having down to the following inexplicable behaviour within the .NET System.Text.Encoding class:
byte[] original = new byte[] { 128 };
string encoded = System.Text.Encoding.UTF8.GetString(original);
byte[] decoded = System.Text.Encoding.UTF8.GetBytes(encoded);
Console.WriteLine(original[0] == decoded[0]);
Am ...
I have a xml file with following entries, I want to update. I have gone through other related questions but not solving my issue.
<Movie>
<Name>21</Name>
<Year>2008</Year>
<Genre>Drama</Genre>
</Movie>
...
I'm getting the following error when trying to execute a stored procedure which calls a .net assembly deployed within a SQL 2005 database:
Msg 50000, Level 16, State 1, Procedure usp_GetPrintFilePathandExecPrintJob, Line 63
Error (10314) has occured while executing the usp_GetPrintFilePathandExecPrintJob method. Reason: An error occurre...
I compiled my application with monodevelop. And tried to run with mono on Linux. It seems that the System.Windows.Forms.Timer objects' tick event never fires.
It runs without problems on windows, but not in Linux.
The related code roughly looks like this:
// derived from a From
//...
private Timer controlTimer;
//....
protected overri...
I need to add some new functionality to an existing interface. There are already a lot of classes in the project implementing it but a few of them wouldn't need the new set of features. My first approach was to just add the new functions to the existing interface and implementing it everywhere, adding do-nothing functions where applicabl...
In Windows Forms programming, I have this general problem. When the page is loading and populating, in some cases I don't want the logic in the event handlers to run.
The event handling code is primarily to respond to user interaction, but it also runs when the controls are manipulated programmatically. In the past, I've seen people u...
I'm working on some serialization routines, and I need a way to get the type of an input array.
Let's say I have the following object:
class myclass {
public int foo;
public byte[] bar;
}
Now I can get the type of myclass.foo by using GetType(). And if I say that "myclass.bar = new byte[0]", I can infer that bar is an array ...
I'm looking for some Visual Studio snippets for implementing style cop rules.
For instance when style cop returns an error saying my code needs a documentation header it would be useful to have a snippet that creates this header for me.
Has anyone got any snippets for implementing resolution to stylecop rules?
...
Hi,
First of all I apologize if this question is asked before.
I am planning to develop a small application which displays my bank account details(like Mint.com) where I can customize the display of my own. I want to know how and where to start.
Where these OFX API's are available?
Are they free or we need to pay and get access to th...
Hi,
Is there a way to programmatically generate a click event on a CheckBox? I am looking for an equivalent to Button.PerformClick();
...
I have a fixed-length field I'd like to display path information in. I thought in .NET there is a method that will abbreviate long path names to fit in fixed length fields by inserting ellipsis, for example "......\myfile.txt". I can't for the life of me find this method.
...
Hi.
I have 3 classes:
class R{ string NameR;}
class A{ string NameA;}
Class RP
{
R objR;
A objA;
bool result;
}
I use NHibernate so in DB I have a table RP:
[Id] [int] IDENTITY(1,1) NOT NULL,
[Result] [bit] NULL,
[RId] [int] NULL,
[AId] [int] NULL
I need to display in my view a matrix like this:
__ A1 A2 A3
R1 1 ...
This is the scenario:
I have a State Machine Workflow using ManualWorkflowScheduler. Say there are 2 states: State1 and State2. State1 contains an EventDrivenActivity1 that has a SetStateActivity1 moving the workflow from State1 to State2. State1 also has a StateFinalizationActivity1.
So my question is:
When an event is raised and Set...
We need to develop an application which is going to be installed on Virtual Machine running Windows.
We all know the performance of the .Net is about the same as the native C/C++ code. Is it also true for Virtual Machines?
...
How do I proper case text as the user enters it in a WPF form. I'm using the following code to do the proper casing which works fine, but I can't figure out how to do it on user entry.
Microsoft.VisualBasic.Strings.StrConv(txt.Text,VbStrConv.ProperCase,0);
...
I am maintaining some code which looks something like this. It's a Windows service which does some work every 30 minutes. The ActualWorkDoneHere method takes about 30 seconds to run, but if it is stopped while running it can leave things in a bad state. What is the best way to prevent that from happening? Should I replace the While(t...
I'm implementing a somewhat complex configuration section for a system monitoring project:
<monitoring>
<components>
<component name="Remote Server"
statusProviderType="ClientEndpoint"
statusProviderName="endpoint1" />
</components>
</montioring>
<system.serviceModel>
<client>
<endpoint name=...
Using .NET 2.0, C#, Windows Forms development, Enterprise Library 3.1.
We have a project namespace (call it Project). We also have several sub-namespaces inside of that project, for example Project.Namespace1, Project.Namespace2, etc.
In one class, we define enums and such to be used with the Enterprise Library Logging block, like thi...
I want to encrypt some server data using .NET's RSACryptoServiceProvider and decrypt it when someone enters a key/password via a web page. What are my options for protecting, or ideally not even storing, the private key on the server, whilst avoiding having the user supply it all each time?
Encrypt the private key using a symmetric sys...
A typed array implements both the System.Collections.IList and System.Collections.Generic.ICollection<T> interfaces, which both have their own IsReadOnly properties. But what on earth is going on here?
var array = new int[10];
Console.WriteLine(array.IsReadOnly); // prints "False"
var list = (System.Collections.IList)array;
Console.Wri...