.net

What are the different methods for injecting cross-cutting concerns?

What are the different methods for injecting cross-cutting concerns into a class so that I can minimize the coupling of the classes involved while keeping the code testable (TDD or otherwise)? For example, consider if I have a class that requires both logging functionality and centralized exception management. Should I use DIP and injec...

Getting connection closed error when trying to read response from FitNesse REST URI

Have you run into this problem? I run code remarkably similar to that from a this previous question, When in nUnitTest mode and the URI includes "/?test&format=xml" the nUnit test fails with and IOException, "Unable to read data from the transport connection: The connection is closed." However the Fiddler trace that was running at the t...

Managed C++ internal class?

Is there a may to make a managed C++ class "internal"? I.E. What is the equivalent of "internal class" in managed C++? ...

Is there a version of Rotor for .NET 3.5? If so, where?

Is there a version of Rotor for .NET 3.5? If so, where? ...

UserName Authentication web services

I need to implement UserName authentication for my web service. Currently I am considering these two approaches SOAPHeader: http://www.codeproject.com/KB/cpp/authforwebservices.aspx UserNameToken: WSE 3.0: http://msdn.microsoft.com/en-us/library/aa480575.aspx Can anyone tell me pros-cons of these approaches? One of the major doubt ...

best way to clear contents of .NET's StringBuilder

Hello, I would like to ask what you think is the best way (lasts less / consumes less resources) to clear the contents in order to reuse a StringBuilder. Imagine the following scenario: StringBuilder sb = new StringBuilder(); foreach(var whatever in whateverlist) { sb.Append("{0}", whatever); } //Perform some stuff with sb //Clear s...

Convert DataRow to object

Hi, I've created generic List and populate with some objects. Then List I mentioned before converted into DataTable to use in DataGridView. Problem is when I want get Row from this grid I have DataRow. I wanted to convert this to my object againt but not sure how to do it. Maybe you could give some example? Thanks ...

C# Auto generation of class objects from XSD

I'm creating an xml file and have an XSD file to work against. I'm sure I remember reading somewhere that C# can automagically create class objects when given an XSD. So if I have an address element in XML I can have a generated C# class that uses the xsd to create the required properties of the class. e.g.<adress><postcode></postcode>...

C# - Not saving right in Array - why will it save the first one but not the rest?

This is a homework problem - so I would appreciate if you could tell me what I am doing wrong and how to fix it, resp. how to optimize my programing techniques :). Thanks! I built this to save the employee in the array - it will save the first one right but when it saves the others it shows up blank - right out of the constructor. Why...

.net Label accelerator key event

dumb question here, but I can't figure it out...I have a label with an accelerator key set (e.g. "&Add") and I want to give focus to a textbox when that shortcut, Alt-A, is pressed. what event does this correspond to? I tried the click event but that didn't do anything... edit: found my own answer - it sets focus to the control that is ...

How to add timestamping signature to System.IO.Packaging.Package?

There is a way to create packages, add some parts and sign it with a X509Certificate. I would also like to add a timestamping signature to the package. If the certificate expires or gets revoked the signature should remain valid if the package parts have been timestamped before the expiration/revokation. P.S. I'm using the System.IO...

Is WSDL sort order relevant?

I'm refactoring an existing C# .NET Web Service that is consumed by existing Delphi 2006 (non-.NET) clients. I don't want to rebuild/redeploy the clients. My goal is to keep the WSDL identical so that the proxy classes won't change. I used a tool (Regionerate) to region and sort the methods/properties based on our current standards. Thi...

Are the .NET Membership dates recreated on a restore?

After having restored a database recently that contained the ASP.NET membership provider tables, I noticed the LastLoginDate and LastPasswordChangedDate are now right around the time of the restore. It doesn't look like these fields are auto calculated, so why are they recreated during the restore? ...

Why there is no something like IMonad<T> in upcoming .NET 4.0

... with all those new (and not so new if we count IEnumerable) monad-related stuff? interface IMonad<T> { SelectMany/Bind(); Return/Unit(); } That would allow to write functions that operate on any monadic type. Or it's not so critical? ...

UI And TcpClient Issue in vb.net

Hi all, I'm having some problems with a small ircbot i'm writing. Basically I connect to the server using a tcpclient in a seperate class, which also runs on its own thread. I want to display the server text in a richtextbox control on the main form. The big issue I'm having is that as soon as the text starts coming in the whole applica...

Suppress xsi:nil but still show Empty Element when Serializing in .Net

I have a c# class that has 20+ string properties. I set about a fourth of those to an actual value. I would like to serialize the class and get an output of <EmptyAttribute></EmptyAttribute> for a property public string EmptyAttribute {get;set;} I do not want the output to be <EmptyAttribute xsi:nil="true"></EmptyAttribute> ...

Performance Issue when setting connection information Crystal Reports

I have developed a method that sets the Crystal Reports Connection. This method first grabs the connection string from the config file creates a Crystal Reports ConnectionInfo object. The following code then takes over 5 seconds to run: Dim myTables As Tables = report.Database.Tables Dim myTableLogonInfo As TableLogOnInfo = New TableL...

How can I debug objects loaded from the app.config using reflection?

I have some code that references an outside DLL which in production will be loaded by a factory. The DLL shouldn't be referenced directly by my assembly, it will be loaded at runtime using Assembly.Load(). This all works just fine, but when it comes to debugging, I want to be able to step through the library as if I'd referenced it usi...

What is a predicate in c# ?

I am very new to predicate. just learned how to write a predicate like Predicate<int> pre = delegate(int a){ a %2 == 0 }; what will the predicate return ? and how is it useful when programing ? ...

Exception caused by AppDomain when it shouldn't?

I am working on my MCTS and currently studying the AppDomain functionality. But I am running into something unclear. AppDomain should be capturing Exception and allow the domain to safely unload. (With the possible exception of the StackOverflowException as suggested elsewhere) AppDomainSetup setup = new AppDomainSetup(); setup.Applicat...