Questions tagged [.net]

.NET is a software framework supporting a multi-language paradigm and supporting language interoperability. .NET applications are executed in a virtual machine (CLR) which provides a few important services: security, memory management and exception handling.

Filter by
Sorted by
Tagged with
6
votes
2answers
9k views

Database access class

I'm looking for any comments or feedback on my database access class. Security and speed are two things I'm most concerned about. One thing to note is this class has to work in a C# .NET 2 ...
12
votes
1answer
606 views

Utility functions for supporting memoization for functions

I've got a couple of utility functions to support memoization for functions with anywhere between 0 to 8 arguments: ...
6
votes
4answers
7k views

Function to test if the current time is within a time window

I have written the following code that tests if the current time is within a time window. It seems to work ok with my test cases, but I would be interested if anyone can see any possible problems or ...
4
votes
4answers
479 views

Comment formatter

...
10
votes
2answers
3k views

Async Task implementation

Beeing on .NET 3.5 i don't have access to the TPL. Yet i have become fed up of having to manage manually the logic behind delegate.BeginInvoke type of scenarios each time and i set up to implement my ...
3
votes
1answer
238 views

Refactor a subroutine that divides date range into quarters.

The subroutine below, GetDetailsQuarterly, accepts two dates. Then it writes out each quarter that falls within the date range. It also gives the first and last day of the quarter. I really don't like ...
7
votes
2answers
33k views

Is there a better way to search directories for a file or files?

Edit: The purpose of this method is to search a specific directory for a given file type, ex. (*.txt, *.pdb, *.exe") then move the file(s) to a given destination directory and delete the original ...
6
votes
1answer
4k views

Why is this code to paste into a DataGridView so slow?

...
11
votes
3answers
8k views

Searching a sequence for a pattern

I have written the following tiny extension method to help me when I'm working with sequences in which I have to find a pattern. ...
19
votes
3answers
8k views

scoped_ptr for C++/CLI (ensure managed object properly frees owned native object)

Motivating SO question: Is there a C++/CLI smart pointer project (e.g. scoped_ptr)? I'm interested in any reviewer comments, and especially identified bugs or inconsistencies with the native ...
10
votes
2answers
611 views

Left join query of user profiles

I have the following left join LINQ query that is returning the results that I expect, but it does not "feel" right. I need ALL records from the UserProfile table. ...
7
votes
3answers
4k views

ThreadSafeObservableCollection of (T)

The idea here is to implement a simple, threadsafe, observable collection that clients can bind to, whilst background threads can update. Changes in the contained items raise the ...
5
votes
1answer
530 views

WebMethod slower on execution than Windows application of the same code

I have developed an application that interacts with IBM ClearQuest. The problem is that when I run everything locally, such as, run the webservice local and then ASP page local, everything is at the ...
6
votes
2answers
3k views

Best practice instantiating generic delegates and accessing property getters

I want to create delegates to access properties of different objects without knowing them in advance. I have the following definitions ...
3
votes
1answer
794 views

Retrieving context menus from the form

I have the following code which is a private method inside the form and retrieve all context menus from the form. I feel, that it is not that concise as it should be. Would be grateful for any ...
11
votes
2answers
27k views

Mapping ExpandoObject to another object type

I am working on a helper method that maps properties from an ExpandoObject to a user supplied object and was wondering if the code could be cleaned up or made any ...
7
votes
2answers
6k views

Recursive database actions

I am been using a code pattern for recursive database actions in my applications. I create two class objects of a database table, singular one (e.g Agent) for holding single record with all fields ...
8
votes
7answers
1k views

Refactoring a bunch of and statements

Trying to refactor this code and can't seem to think of a way to make it cleaner. Type is a property in my Person class. ...
11
votes
5answers
8k views

Deep nesting when looping over an object model coming from a 3rd part

I am stuck with this horrible object model coming back from a 3rd party product. It's six levels of objects deep, and I have to loop through the collection in each level, to get the values I need, in ...
8
votes
2answers
4k views

Automatic translation of forms

I want my application to support multiple UI-languages (aka i18n). To do so, I have built the static class below, to automatically translate the form and all its contents to the desired language. It ...
11
votes
5answers
9k views

Nested if statements with 3 different parameters

I have a block of code below. The allDone() method at the bottom should only be run if the allCompleted == true. It should run ...
10
votes
1answer
518 views

Getting the last date where a given week day occurred

I'm trying to learn a little bit about functional programming and as my tool I chose F# since I'm a .NET developer and the environment is more natural to me. In one of my pet projects I'm dealing ...
14
votes
6answers
1k views

Form to create new students or view existing student information

I started out with the best of intentions, but this form got hacky real fast. It's purpose is to serve as a create new Student form. Also, if you want to view an existing Students information. Think ...
21
votes
3answers
16k views

Determining if a connection has been made to a communications device

I am unsure if my use of Monitor.Wait and Monitor.Pulse is correct. It seems to work alright, but there is a nagging doubt I am ...
23
votes
5answers
18k views

Best way to pass parameters to Factory class?

So I have a series of objects, which I will call Impl1, Impl2, and Impl3. They each implement an interface, called IImpl. I have a Factory class who's task is to retrieve the ImplX which is ...

1
19 20 21 22
23