For the equivalent mechanism in C++ (the destructor), the advice is that it should usually not throw any exceptions. This is mainly because by doing so you might terminate your process, which is only very rarely a good strategy.
In the equivalent scenario in .NET ...
A first exception is thrown
A finally block is executed as a result ...
Hi!
I am looking for an elegant way to get the OS version like: "Windows XP Professional Service Pack 1" or "Windows Server 2008 Standard Edition" etc. Is there an elegant way of doing that? I am also interested in the processor architecture (like x86 or x64).
cheers
...
I have some old code in Javascript that interfaces to Java DWR. I'm looking to port the back-end to .NET/C# possibly, and I was just wondering if there was an equivalent AJAX framework that would work in the same manner as the DWR framework in Java.
...
I have a DataGridView that has a ComboBox column. I populate this column's list with items of a type Field:
DataGridViewComboBoxColumn fieldsColumn = argumentsDataGridView.Columns["field"] as DataGridViewComboBoxColumn;
foreach (Field field in SessionData.Fields)
fieldsColumn.Items.Add(field);
f...
I am developing a set of classes that implement a common interface. A consumer of my library shall expect each of these classes to implement a certain set of static functions. Is there anyway that I can decorate these class so that the compiler will catch the case where one of the functions is not implemented.
I know it will eventually ...
I have a console application that I am rebuilding from C to C#. This application has to be able to support the legacy method of storing information like parameters from a command-line and parameters from a file (called the system parameters) that customize each run. The system parameters file is in plain-text with a simple key : value ...
I've got a wrapper class which encapsulates a piece of information that needs to be transmitted as a byte array.
In that way, the class encapsulates the necessary header (with fields like DATA_LENGTH or MESSAGE_TYPE) into the corresponding byte positions. For that I want to define positions and length in constants, for example:
HEADER_...
I am doing some reading, and came across avoiding an internalStore if my application does not need to massage the data before being sent to SQL. What is a data massage?
...
If I have the following enum:
public enum ReturnValue{
Success = 0,
FailReason1 = 1,
FailReason2 = 2
//Etc...
}
Can I avoid casting when I return, like this:
public static int main(string[] args){
return (int)ReturnValue.Success;
}
If not, why isn't an enum value treated as an int by default?
...
Is there a succinct way to represent a bounded numeric value in .NET 3.5?
By this I mean a value such as a percentage (0 - 100) probability (0 - 1) or stock level (0 or above).
I would want a ArgumentOutOfRangeException (or equivalent) to be thrown if an out-of-range assignment was attempted. I would also want static MaxValue and MinVa...
I've wrapped a dll method that has an integer as an out parameter in a web service.
In testing I was finding that when I was expecting -1 I was getting 65,535 instead. I realised that the dll was using 16 bit integers and I was specifying the standard .NET 32bit integer when referencing the external dll in my code. this was quickly fixed...
I have a DataGridView that is displaying a List of objects (not DataSet).
Is there an easy way to set a filter, so the DGV will only display rows that match the filter?
IList<T> log = ...;
dgv.DataSource = log;
...
I am not sure I am getting the correct definition for what API Usage is. I have a snippet of code that is used for a BulkInsert into SQL from c# application. It said the snippet shows the API usage. How do I translate that?
private void WriteToDatabase()
{
// get your connection string
string connString = "";
// connect t...
I have developed a console utility that performs some operations against a server application. Due to the nature of the server app I'm working with, I need to execute this utility on the server.
The problem is that the utility is referencing a common DLL that has previously been deployed to the server's GAC. Since the common DLL's deplo...
Looking for a good overview about .NET web services and SOA architecture. Any suggestions?
Any good links?
...
What is he best way to implement Watermark functionality for a System.Windows.Forms.TextBox in .Net 2.0 with C#?
Edit:
Using the ready-made component from CodeProject was very easy. It's also with a The Code Project Open License (CPOL).
...
I have a set of custom XML configuration management classes in .NET.
There are two configuration scopes in my application:
User: the setting applies to the user regardless of the account she's logged into. Stored in a XML config file in the user's directory.
User/Account: the setting applies to the user when logged into a particular ...
Hello All,
I'm having trouble getting LINQ to translate something into the query I need. In T-SQL, we do a <= and >= comparison on three columns that are CHAR(6) columns. LINQ will not allow me to do this since
Operator '<=' cannot be applied to
operands of type 'string' to 'string'.
I have the following T-SQL query..
SELECT ...
<FileTransferSettings>
<UploadPath src="user">C:\uploads</UploadPath>
<DownloadPath src="app">C:\downloads</DownloadPath>
</FileTransferSettings>
I'd want to deserialize this XML into a FileTransferSettings object with 2 properties - UploadPath and DownloadPath. But I also want to preserve the src attribute for each property in a...
So I have never seen this issue before and don't know where to begin troubleshooting the issue.
Cannot register assembly "obj\Debug\MyProject.Vsto.dll".
Loading this assembly would produce a different grant set from other instances.
(Exception from HRESULT: 0x80131401)
Where do I start to troubleshoot this?
I should mention this...