I often find myself writing a property that is evaluated lazily. Something like:
if (backingField == null)
backingField = SomeOperation();
return backingField;
It is not much code, but it does get repeated a lot if you have a lot of properties.
I am thinking about defining a class called LazyProperty:
public class LazyProperty<T>...
I know what Reflection is but why would I need to use it in a typical line-of-business Winforms app?
...
Is there a way to check that the method signatures of a bunch of .NET dlls are "lined up" against one another? Basiclly what the complier does during compile time,but instead it would be trying me trying to move a single dll up instead of the whole group of 20 to fix a problem.
For example you have a function that lives in AssemblyB.dll...
All articles I've read about localization of a WinForms application assume that I already have all the strings translated. According to the articles, I should just set the Localizable property to true and edit all the controls.
But how do I get all the original (English) strings from the form? Assume I have a complete application, which...
Problem: How to most efficiently move data from an array into a SQL Server table.
Details: I have created an array with many rows (typically, about 100,000) and many columns (about 40) in memory in a WinForms application. I need to get this array into a corresponding SQL Server table in the fastest way possible. Right now, I am creating...
I'm trying to set the DisplayMember Property of my ListBox in a windows forms project to a property of a nested class inside a Generic List I am binding to.
Here's a simple example:
public class Security
{
public int SecurityId { get; set;}
public SecurityInfo Info { get; set;}
}
public class SecurityInfo
{
public ...
How do you manage to use and practice the Microsoft technologies without the ability or desire to pay for all of the software needed?
Are there free versions of Visual Studio, SQL Server, and plugins? Are there any tutorials on how to set up ASP.NET Development on a local server? Is it practical to develop and test on my own machine?
...
Have been looking at the MVC storefront and see that IQueryable is returned from the repository classes. Wondering if you are not using LINQ does it makes sense to return that object? In the case of LINQ in makes sense because of deferred execution, so adding filtering in the service layer makes sense, but if you don't use LINQ you wou...
Have you used the OpenAccess ORM from Telerik? How does it compare to NHibernate? When should I consider using it over NHibernate?
...
Maybe you can help me...
I am writing a program in Windows Mobile that connects to a mail-server and retrieves data from a POP3-server. I am using a third-party (free) socket available from here. I am using VS 2008 (in VB.NET) and the device-emulators.
I can connect without any problems and execute my various commands (such as logging ...
I've seen a couple .net applications that allow you to select a C# .cs source file and the program itself will compile this code and run it.
How is this done?
...
So, I have a method that performs a parametrised LIKE query. The method takes in the search parameter/value in and then it is added to the command ready for the query.
It is not working. It should work, and when I code the value to search for directly into the SQL string, sans parametrisation, it does work! When I have it as a paramete...
Since Winform Datagrid in .net 1.1 lacks of cell edit events like Datagridview in 2.0. i am wondering if there are certain workaounds in order to add validation events when users finishing editing a cell in a datagrid.
wishing our customer to let us upgrade his apps to 2.0 at least
...
I have a data tier select method that returns a datatable. It's called from a business tier method that should then return a strongly typed generic List.
What I want to do is very similar (but not the same as) this question:
http://stackoverflow.com/questions/208532/how-do-you-convert-a-datatable-into-a-generic-list
What's different i...
Everything works fine when the unit tests class is part of the main project (TestAccount).
Every article I've read about unit testing recommends putting the tests in a separate project, so I...
added another project
(TestAccount.UnitTests) to the solution
moved the unit tests class (AccountTests.vb) to TestAccount.UnitTests
and ...
Hi,
Shouldn't classes in DAL (customerDAL) be singleton? Since my controllers (customerController) exposes "Shared Subs", then on every call, there is no need to create a new DAL object if already existed. Correct?
Thanks
...
What is the class hierarchy that is most necessary to get a excellent grasp of, for the aspiring C# desktop applications programmer? Not just the totally obvious stuff.
EDIT: To clarify, I mean, that as I am learning C#, I would like to know what are the classes I should be acquainting myself with, that aren't necessarily going to be ...
I have a Person class in the Model and want to assign 15 of its attributes to labels in the View. The View shouldn't access the Model. That means the Controller will handle creating the Person. How does the View get these Person attributes from the Controller? If the Controller contains a member of Type Person, the View can do someth...
Duplicate: http://stackoverflow.com/questions/263400/what-is-the-best-algorithm-for-an-overridden-systemobjectgethashcode
If you've written an object with a variety of data-members, how do you intelligently implement GetHashCode()?
One developer told me he just XORs (^ operator) the Hash of relevant data-fields, but I am unconvinced ...
I'm writing a Windows Service for communication with a Serial Mag-stripe reader and a relay board (access control system).
I run into problems where the code stops working (i get IOExceptions) after another program has "interrupted" the process by opening the same serial port as my service.
Part of the code is as follows:
public parti...