.net

How to store arrays in a database?

I have a simple messaging system that up till now uses file based storage. Because the number of users of the system is increasing gradually I would like to switch over to database based storage. In code the message server maintains a list of users (with their credentials) and a list of messages. A Message object has as its main fields a...

WPF Beginner Tips

I am starting out with WPF and am surprised at how completely different it is from anything I have done before, there is a lot to take in. Can anyone recommend stuff that is worth knowing up front that will make life easier when it comes to developing a WPF app? Thanks in advance. ...

Finalize method in System.Object class.

Out of curiosity i disassembled mscorlib.dll to check the implementation of System.Object class. I found something weird in that. 1). public class Object { ... protected override void Finalize(){} ... } How come a base class has an overriden method in it? 2) public class Employee { public void InstanceMethod() { ...

List<T>.AddRange implementation suboptimal

Profiling my C# application indicated that significant time is spent in List<T>.AddRange. Using Reflector to look at the code in this method indicated that it calls List<T>.InsertRange which is implemented as such: public void InsertRange(int index, IEnumerable<T> collection) { if (collection == null) { ThrowHelper.Throw...

Circular reference when convert Ilist<T> to Json in s#arp

I have two classes, which have one to many relation between them. When I use s#arp to return lists of these tow classes, everything is ok. But after I try to convert these two lists to Json format, I get a "circular reference" exception. I have search this kind of exception on the web, and find it is an common question. So, may I as...

Domain Driven Design - How to use value object on the UI

Hi all, I was wondering how you use your ddd model within a web application. Within Eric Evan Cargo application there's the Cargo class which contains the value object Itinerary. Within Itinerary is a collection of Legs, again a value object. All value objects hide the surrogate id to the outside world. So when using this domain model,...

Random access and BinaryWriter?

I'm working on a project where I'm building a byte array that's almost like a serialization of the object graph. Each class is responsible for writing out it's own data, so I'm thinking about using a BinaryWriter and pass that instance around to my child objects and let them serialize themselves into this instead of creating temporary bu...

How to run the same testmethods while only changing the dependencies?

I have 5 testmethods that test the functionality of a PasswordManager object.I use the built in test engine of visual studio 2008. This manager can make use of two Dependencies: an XMLStorageManager or a DbStorageManager. The Dependency is set in the Passwordmanager's constructor. How can I run the tests twice with the only difference th...

Unable to decrypt aes ciphertext with slowaes (javascript)

I have a cipher text I encoded with the AesManaged .Net classes. plaintext: "string" password: "password" this is the c# code I use to encrypt: private AesManaged AESCipher; private String Password; public AES(String Password) { this.AESCipher = new AesManaged(); this.AESCipher.Mode = CipherMode.CBC; ...

Client side validation of multiple radio buttons groups

This is my code: <html> <head> <title>scoreboard</title> <script> function calculate() { var sum=0; var total=0; for (var i=0; i < document.questions.group1.length; i++){ if (document.questions.group1[i].checked){ sum = parseInt(document.questions.group1[i].value) total = parseInt(total + sum);}} for (var i...

WCF communication between 2 servers crashes after IIS7 process recycle

Hi guys, I am kind of stumped with this one, and was hoping I could find some answers here. Basically, I have an ASP.NET application that is running across 2 servers. Server A has all of the business logic/data access exposed as web services, and Server B has the website which talks to those services (via WCF, with net.tcp binding). T...

What are some of the best ways of doing silent updates for a desktop app?

Specifically, this is for a .NET 2.0 desktop application. Currently we require the user to manually go through the update process via our website. What are the best ways of doing a silent or automatic upgrade of the client behind the scenes? Thanks! ...

Can't Create ActiveX Control

Hey Everyone, Working on getting a legacy app up and running again for work. I'm getting an error at run time that I can't create an activeX control. The suspect call is oSQL = CreateObject("SQLDMO.SQLServer2") I did a bit of googling and found that SQLDMO should be in a SQLDMO.dll. I've got that DLL referenced in my project but it i...

xsd schema not valid?

I've downloaded the official "schema of xsd" from http://www.w3.org/2001/XMLSchema.xsd. I saved it locally and tried to validate with this code: var sc = XmlSchema.Read(new FileStream(@"c:\temp\xsd.xsd", FileMode.Open), validate); sc.Compile(validate); It failed with an exception that it cannot find some DTD. Question number 1: Why ...

How can one check for "safe" conversions between value types in .NET?

Back to the basics... For reference types, one can do this: SomeType someObject = firstObject as SomeType; if (someObject == null) { // Handle the situation gracefully } else { // Do stuff } For value types, my understanding is that we have implicit conve...

Good non-relational/quazi-relational DB with .NET API?

Anyone have any recommendations for a non-relational/partially-relational DB with a .NET API? ...

English grammar checker engine for .NET?

I am looking for an English grammar checker engine (not spell checker) to be used on server side in .NET and Windows. I found one at wintertree-software.com but it's over $1000. Found these resources 1, 2 on SO. I prefer to use a ready to use engine. Feed it sentences, paragraph or text documents and it spits out grammar suggestions as ...

What's the best way to create a percentage value from two integers in C#?

I have two integers that I want to divide to get a percentage. This is what I have right now: int mappedItems = someList.Count(x => x.Value != null); int totalItems = someList.Count(); (int)(((double)mappedItems /(double) totalItems) * 100) This gives the right answer. But that is a lot of casting to do something as simple as get a ...

What is the accepted standard for dictating lambda expressions?

Possible Duplicate: How do I pronounce => as used in lambda expressions in .Net Sometimes, when helping another programmer write code, I dictate what I want them to type in. Sometimes this can be a frustrating exercise until the programmer gets used to how you verbalize code (i.e. "assign 5 to x" versus "x equals 5"). One thin...

Is there a CASPOL.exe GUI command line generator?

Is there a simple utility/GUI application for generating CASPOL commands? ...