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
3
votes
3answers
5k views

FTP Download Function

This is an function that downloads a single file from an FTP server and saves it to disk This is my first time doing anything with FTP, please let me know if i have missed anything. ...
0
votes
5answers
2k views

How to optimize this validation method?

Looking to optimize this method so it will run quicker, but can't seem to find anything. WOrking in .NET 3.5. ExcludedWords and NewCodes are both HashSet of strings. ...
1
vote
1answer
184 views

What should I do to improve this snippet

Though it works I wonder if there might be a better way to do this. I would like to reuse this loading and establishing of fields of another class(es) (the static TileMapper class mentioned at the end)...
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. ...
5
votes
3answers
198 views

Refactoring code into a simpler method

I have some code that loops over a number and populates a list using other lists. I think I can refactor it somehow to make it look nicer but not sure the best way to do it. Here is the code: ...
1
vote
2answers
1k views

Refactoring different type of param to reduce duplicate code

So say I have a method that does a bunch of stuff, and I want to refactor this method to take a different type of parameter: ...
3
votes
2answers
1k views

Is this right way to implement Abort, Retry and Ignore activity pattern?

I've a bunch of sequential activities. These are long running. Once an activity is complete, it can't be rolled back. Now something deep down the line fails. Now I've few options Report this to end ...
2
votes
2answers
11k views

Importing XML to a database using LINQ to Entities

I am importing XML data to a MySql database using LINQ to Entities. The data represents which students are in which classes, and looks like... ...
2
votes
2answers
2k views

Business Layer - UI communication [closed]

Taking the following cases in consideration. Witch one would you prefer and why? Suggestions appreciated. Using Delegates ...
4
votes
1answer
14k views

Generic wrapper for System.Runtime.Caching.MemoryCache

I have implemented a simple generic wrapper for MemoryCache class. Its interface looks like ConcurrentDictionary class but I tried to keep it simple. I tried to keep operations atomic, hoping not to ...
4
votes
1answer
9k views

Query String Serializer

I have a ASP.NET Web Forms project, and I want to build calls to .aspx pages in a strongly-typed fashion. I ended up rolling my own serializer that takes simple structs and saves them to/loads them ...
3
votes
1answer
188 views

C# expression evaluator review request

I successfully created an expression evaluator in C#, and I would like to know if it works well, and what I can do to improve it. ...
3
votes
1answer
702 views

Review an asynchronous/message-oriented library actor

I'd like to get input on a F# actor that coordinates receives around a blocking message buffer. The actor is a piece of code that continuously tries to fetch messages from Azure Service Bus. ...
3
votes
2answers
1k views

Is the solution design optimal? C# 3 - Tier

I have the following solution structure. This is a business domain (for an amount transfer operation in bank account) which will be called by a WCF service. Is the solution structuring correct? Data ...
3
votes
1answer
2k views

Refactoring legacy code for unit testing

I'm trying to refactor some code for unit testing and was hoping you could critique it. This is the original method: ...
2
votes
2answers
1k views

Trace-like extensions for unit testing

Below is a set of extensions that I use in unit tests. The basic idea is that when creating or modifying some sort of user output type of string, I want to eyeball the output to see that it makes ...
4
votes
1answer
473 views

Find log4net logfiles at runtime without adding dependency to project

I was searching for a way to get all active log4net logfiles (if any) at runtime without adding a reference to the project. This is the solution I came up with: ...
4
votes
1answer
1k views

Providing factory method to Lazy<T> when factory exists on another lazy instance?

The Problem I found myself needing an instance of an IObjectContext interface that should never be null, but wanting to delay instantiation until after some ...
6
votes
1answer
476 views

Comparing DoublyLinkedList<T> implementation performance with other BCL (.NET) classes

I have implemented generic doubly-linked list class, which supports IEnumerable<T>,IEnumerator<T> interfaces. ...
3
votes
1answer
245 views

C# asp.net project functionalities

I just started working in a project that wasn't developed by me, I'm worried about some of the functionalities and I would like some suggestions. After the login validations, the login procedure is ...
5
votes
1answer
4k views

Convert .NET DateTime to a string using ordinals

With a DateTime object, it's easy to get, for example, 11 October 2011 by using: d.ToString("d MMMM yyyy"); However, there ...
5
votes
4answers
7k views

Presenting a boolean as an int for XMLSerialization in C#

I'm working with an XML structure that requires booleans to be represented as 1 or 0. So, suppose the XML output has to look like: <valid>1</valid> ...
2
votes
1answer
452 views

Simple search page.

...
7
votes
3answers
1k views

3-layer ASP.NET app - Need critique/advice

My current setup is a 3 layered application: UI > BLL > DAL. Each layer is set up as a separate project. The UI is an ASP.Net website and the BLL & DAL are Class Library projects. I've shown some ...
5
votes
3answers
2k views

Guarantee at least one in a list

This is a short piece of code but I feel like it could be done more elegantly. What am I missing? The goal: if there are any items in a list, and none of them have a given property, set one of them ...
3
votes
2answers
146 views

Subclassing, NVI

Should the following be considered wtf code? ...
4
votes
1answer
248 views

Is there any loss in performance converting a 'where' clause to a lambda?

Is there any different in performance for the following 2 queries. I'm just wondering what is the better of the two: ...
5
votes
1answer
1k views

Trying to un-hack this DataTemplateSelector

I'm trying to emulate the default behavior of an ItemsControl in a ContentControl--Bind Content to an object property and use the correct DataTemplate based on that ...
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
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 ...
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 ...

1
19 20 21 22
23