If you frequently use in your program a collection which path would you prefer:
Type List<T> everywhere.
Define class:
class TT:List<T>
{
}
Define class:
class TT
{
private List<T> _tt;
// ...
}
I think it's not very important, but after last project I started to think about it very often.
...
Using TabControl.SelectTab("...") shows the tab but it also gives the tab focus. I would like to show a particular tab, but keep focus where it is.
I have data rows in a grid. Based on properties of the selected row, I show a different tab page to have a different UI layout. But when using arrow keys to scroll through rows, the focus...
How do you break out of a foreach loop while within a switch block?
Normally, you use break but if you use a break within a switch block it will just get you out of a switch block and the foreach loop will continue execution:
foreach (var v in myCollection)
{
switch (v.id)
{
case 1:
if (true)
{
...
Hello,
I'm working with .net Reflector to view some .net Compact Framework .dlls and I'm getting an "Object reference not set to an instance of an object" error for one of them. I downloaded the trial version of 9Rays.Spices.Net and it loaded the .dll just fine. The only problem is that I'm getting only every other method.
I was able...
Microsoft provides a bunch of standardized error codes for Windows (http://msdn.microsoft.com/en-us/library/ms681381(VS.85).aspx). When applicable I find them useful to reference in my own applications, instead of creating my own. Is there something similar but specific to .NET?
...
Hi,
I have a listview with a the property checkbox = true.
When the user clicks on the checkbox and changes its state (checked -> unchecked or unchecked -> checked), I catch the ItemCheck event and do some DB implementation.
I want to ask the user for confirmation before working with the DB.
When I the user cancel it's command, I wan...
So say I have one xml file such as this:
<shapes>
<shape>shape1</shape>
</shapes>
And another xml file like this:
<parentNode>
<shapes>
<shape>shape 2</shape>
</shapes>
</parentnode>
I would like the output to be:
<parentNode>
<shapes>
<shape>shape1</shape>
<shape>shape 2</shape>
</shape...
Let's assume I have the following text:
"something [234][3243]"
I am trying to pull the values in between the square brackets. I came up with the following regex expression: .*\[(.*)\].* however this only allows me to pull the last value in between the brackets, in this example 3243. How do I pull all values, meaning get more groups ...
I've used the ThreadPool.GetAvailableThreads to monitor the thread usage in a web site, and written the results to a performance counter. To do this, I've had a thread running in the site that does the monitoring. I'd like to be able to monitor this without modifying sites' code. Is there a way I can write a console app that would be abl...
Java Socket Server
I have a Java process that is creating a listener on a TCP Socket using java.io.ServerSocket something like this (simplified):
ServerSocket server = new ServerSocket(4444,20);
server.accept();
The Java Process Fires off a Worker Thread when a Request Is Received and the Worker then sends a JSON string using jav...
To all the .NET experts, I have a question for you.
I need to do SOAP/HTTP over named pipes on Windows, in C#. (This is for a client talking to a Python library/server using SOAP for RPC. Using socket/port was deemed both insecure, and port configuration becomes a hassle.) There are two problems.
There is an HttpWebRequest class,...
I'm (unfortunately) using VS 2003 to develop for some Windows CE .NET 4.1 mobile devices. The app is written in .NET Compact Framework 1.0 (the OS cannot support any later version of the .NET CF).
Whenever I run my app from Visual Studio, it copies/tries to install .NET CF 1.0 to my device:
Copying netcf.all.wce4.armv4t.cab
It takes ...
Hello all,
One of my clients refers people to a certain URL. She prints the URL on physical letters, and the recipients have a few weeks to visit the URL and complete the task. Let's say that the URL she gives is:
www.department-a.domain.com/folder/important-page.html
The problem is that I am switching Content Management Systems so ...
Here's the documentation. I haven't found any explanation anywhere. There is a data binding overview but is for WPF, and I'm using WinForms. I thought what it does is to call whatever method I assign to the event Format of the Binding class, but it will call it even if I set formattingEnabled to false as long as I assign a method. So now...
Where can I see all the built in function of C#? Any recommendation excluding books please :0)
...
I have 2 .NET assemblies that I am exposing to COM via COM Interop.
1st one is a .NET Logger component
The 2nd component has a method where you pass in a Logger object. This all works fine in .NET
When I expose both as COM Interop I am doing the following in classic ASP with COM.
Creating an instance of Logger via COM (Interop)
Crea...
public partial class Form1 : Form
{
MyClass myClass = new MyClass("one", "two");
public Form1()
{
InitializeComponent();
textBox1.DataBindings.Add("Text", myClass, "Text1", false, DataSourceUpdateMode.Never);
textBox2.DataBindings.Add("Text", myClass, "Text2", false, DataSourceUpdateMode.Never);
}...
I need a solution that allows me to create compressed data files (gzip, zip. tar etc. - any format could work) and then freely append data to them without having to load the whole file in memory and re-compress it (seeking while decompressing would be awesome as well). Anyone has a suggestion on .NET?
...
I Have a ComboBox and I would like to bind to two different properties, one in the ComboBox and one in the ListBox. The properties are named Summary and Description. How can I accomplish this?
I Currently have this
<ComboBox x:Name="comboBox"
ItemsSource="{Binding}"
DisplayMemberPath="Summary"
Displa...
Hello -
I have this problem where I need to set "optional" parameters for my stored procedure to work fine.
For example, I have this:
CREATE PROCEDURE [dbo].[Search]
(
@StartTime datetime = NULL,
@EndTime datetime = NULL,
@CustomerEmail nvarchar(255) = NULL,
@OrderStatusID int
)
Now, in my .net website I have this like an exampl...