In my current project I see a lot of this type of code:
public User GetUserByName(string userName)
{
try
{
// Lots of code here to check if the user is in the cache,
// get it from the DB if not, set properties on it, etc...
}
catch (Exception ex)
{
throw new Exception("Exception getting user...
Hi,
I have custom types in a WSE web service.
the consuming client can't seem to see my constructor when instantiating a class, is this normal?
...
Hi,
I was wondering how you would use the TransactionScope class in the correct way when you are dealing with multithreading?
We create a new scope in our main thread and then we spawn of a couple of worker threads and we want these to participate in the main scope, so that for example the rollback is called on each worker if the scope...
How can I delete a column of a Dataset?
Is there a method that will do this for me like this:
rh.dsDetail = ds.Tables[0].Columns.Remove(
Or maybe like this:
rh.dsDetail = ds.Tables[0].Columns.Remove( ds.Tables[0].Columns[1],ds.Tables[0].Columns[2])
...
I have one DataSet that contain 2 relate DataTable (master and details). I want to copy data that match my filter (e.g. master data column A = "XXX") to another DataSet.
Now I found that this process take a very very long time. (about one hour for 1k records)
I want to know how to improve this processing time?
Thanks,
Ek
...
Greetings,
I have two questions regarding a DataTable.Select():
1) How to escape potential apostrophes or any other characters that would cause an issue. I'm not worried about SQL Injection.
2) How to use IN with Like, and include results that have a null.
1) Unfortunately, I can't seem to find any advice for the first option since...
I thought I understood C# regular expressions, but clearly it's not the case. I need some help devising an expression that would find everything from START|BEGIN until )). Expression can be multi line.
Ex.
START( FTP_STATE, XXX(
VAL( FTP_INITIAL_STATE, 0 )
VAL( FTP_INBOUND, 1 )
AL( FTP_OUTBOUND, 2 )
))
/***********...
I am performing a code review (VS2008/.NET 3.5). The development team has created several data access components in a DAC assembly.
I encountered a business proces assembly where every DAC is wrapped with a business component with no additional value or code.
Is this a right premature architectual step ? Just to be prepared for somethi...
From http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.structlayoutattribute(VS.71).aspx:
[C++]
[StructLayout(LayoutKind::Explicit, Size=16, CharSet=CharSet::Ansi)]
__value class MySystemTime {
public:
[FieldOffset(0)] short int wYear;
[FieldOffset(2)] short int wMonth;
[FieldOffset(4)] short int wDayOf...
Edit: Duplicate of http://stackoverflow.com/questions/3927/what-are-some-good-net-profilers
In a previous life as a C++ developer on Linux, I found the built-in profiler gprof to be very handy for finding the best targets for optimization.
Is there a similar tool available for C# or the .NET CLR in general? What profiling tool options...
I am currently trying to send a serialized object over a TCP connection as follows -
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(clientStream, (Object)Assembly.LoadFrom("test.dll"));
where clientStream is
TcpClient tcpClient = (TcpClient)client;
NetworkStream clientStream = tcpClient.GetS...
Hi,
I have a standard Visual Studio (2008) application setup project, which generates an msi containing a few files. I noticed however that:
1) When the msi installs and some of the files already exist, it simply silently ignores these files. This is the behaviour that I don't want, because of obvious reasons.
2) When I uninstall the ms...
I've written some code that is supposed to write a file to the temp directory, then copy it to a permanent location, but find that doing so creates a permission-related error on the copy command. The code looks like this:
string tempPath = Path.GetTempFileName();
Stream theStream = new FileStream(tempPath, FileMode.Create);
// Do s...
What is the difference between Assembly and a DLL? While sending the code to a remote client, should a DLL file be sent or should a Assembly be sent (When direct TCP connection is available between two)?
...
Which one is a better practice in programming?
I am not talking about complete exclusivity. It's more for things like:
list<T>.Find, where you get default(T) or your value, instead of ValueNotFound exception (example).
or
list<T>.IndexOf, where you get -1 or the correct index.
...
Does anyone know if there is a tool to get all assembly information given an assembly. Prefereably in XML format.
Information needed:
Full namespaced assembly name
Title
Culture
Configuration
Version
Informational version
Description
Company
Product
Copyright
Trademark
...
My program starts a process and I need to make sure it is killed before I can run the program again. To do this, I'd like to store the start time of the Process in something like a mutex that I could later retrieve and check to see if any process has a matching name and start time.
How could I do this? I don't really want to stick anyth...
What is the simplest way to get the directory that a file is in? I'm using this to set a working directory.
string filename = "C:\MyDirectory\MyFile.bat"
In this example, I should get "C:\MyDirectory".
...
When I compile my .NET 1.1 ASP.NET app, I'm getting RESX reference problems. How can I easily force VS2003 to dump all these references (I'm not using them) and force a rebuild of them?
...
Can someone explain
to me why in .NET 2.0 if I have an interface, IPackable and a class that implements that interface, OrderItem, when I have a method that takes in a List, passing in a list of List does not work?
Does anyone know how I could accomplish this functionality?
Thanks
Josh
Code:
public interface IPackable {
do...