.net

binding gridview to objects

My C# app contains a Data Object like this: public class Data { public class a {get;set;} public class b {get;set;} } public class a { public int first {get;set;} } public class b { public int second{get;set;} } I initialize my data when the application starts and my data changes evey time the app is running. I have...

String immutability in C#

I was curious how the StringBuilder class is implemented internally, so I decided to check out Mono's source code and compare it with Reflector's disassembled code of the Microsoft's implementation. Essentially, Microsoft's implementation uses char[] to store a string representation internally, and a bunch of unsafe methods to manipulate...

Typical rule of thumb for dividing pieces of code into seperate projects

I'm wondering when to divide code, and components of a project into a separate project. I'm creating a MVC .NET Web project, and there are many directories/sub-directories, and I haven't even started getting into some of the background processes that will take even more space. I'm just trying to work on organizing projects and the code...

SQL to LINQ compare 2 entities for changes - creating an audit trail

I am in the hypothetical phase of thinking of how to do something in code, so I have no concrete code examples yet. But, let's assume you have an entity type Person (with attributes such as first name, last name, DOB, etc.). When one goes to edit a person entity, you may only update one or two fields (possibly all, but usually not). T...

Best/most portable way to version a file format

Hello SO, This question concerns XML schemas and files. Suppose I am developing a desktop application with a file-based interface, i.e. the user stores their progress in a file on disk - pretty standard for the vast majority of productivity applications and many more besides. The file is fundamentally XML, whose schema is stored by som...

Casting "value" in C# property as a IEnumerable<> generic in DataSource override.

Here is your basic DataSource override: public override object DataSource { get { return base.DataSource; } set { base.DataSource = value; } } What I would like to do in the setter method is cast value to IEnumerable<> and do some manipulations on i...

Changing the words keeping its meaning intact...

Hi We have a requirement in which we need to change change the words or phrases in the sentence while keeping its meaning intact. This application is going to provide suggestions to users who are involved in copy-writing. I don't know where should I start... we have not yet finalized the technology but would like to do it in a Python o...

Problem automating mouse and interacting with Flash apps

I written a C# tool that simulates a user interacting with a Windows 7 environment. It works except when interacting with a couple online flash applications. Mouse movements and clicks are being generated, but the Flash apps do not receive them. I am thinking I need to generate lower-level mouse events, but cannot confirm this. I hav...

Dynamically create a compiled .NET exe from source code?

I need to inject a custom, unique, static string into my .NET based EXE. For all intents and purposes, assume that this is my Private key of a PKI. I have a few ideas on how I'll approach protecting the Private key within the C# source code, my question is how do I take my .CS files and create an executable based off it? ...

Does NGEN'ing a .NET application help protect it from reverse engineering? If not when would I use it?

If Ngen doesn't protect my application, when would I reasonably expect to use this application in my career? ...

what is the proper way to share information between Generic Lists

I have a couple of generic lists with completely different types of data. In my generic lists I have created methods to do all the processing that makes sense from that level - that is I have the member function perform a summary and return a value or set of values. One of my reasoning for basing this calculation in the generic list is ...

How do I prevent NGEN from rebasing my code (negatively affecting performance)?

I simply want to speed up my .NET-base client side app and am considering NGEN-ing the code. Jeffery Richter wrote this warning about ngening code: •Inferior Load-Time Performance (Rebasing). When Windows loads an NGend file, it checks to see if the file loads at its preferred base address. If the file cant load at its pre...

What book should I read to learn about writing server (sockets, TCP) programs in C++/CLI?

I recently finished this book on Managed C++, and found it very interesting... But I realize the topic is woefully out-of-date now, with the advent of C++/CLI. So I'm looking for recommendations on a new book to read, something to update my knowledge of C++ and .NET. I'm especially interested in writing server applications (using socke...

Entity Framework function import: input parameters mapping

Hi everybody, Entity Framework allows to map the result of a stored procedure to an Entity easily. What I need is to map an Entity to input parameters, so that instead of context.SaveUser( user.FirstName, user.LastName, ... ); I can simply call it like this: context.SaveUser( user ); What I really want is to isolate possible schem...

Setting up team and development processes

Based upon your experience If you was given the opportunity to set up the development processes for a small development team. Please detail The things you would implement, tools, documents, methodology. And how you would implement these? I wish to implement the following: Source Control Bug tracking database Formal Spec template...

sql query to linq-to-entities

How can this query be transform to linq SELECT materialId, SUM(totalAmount) as quantity FROM Inventory It's the sum part that I don't know how... query = from inv in context.Inventory select new MaterialQuantity() { MaterialId = inv.materialId, ...

What developer sites accept articles and reviews?

Hi there, Could you please drop here a few links to software developer sites or blogs that accept software reviews or articles? BR Murat ...

How to Compare two class objecy with Reflection?

i try to compare two class comp1,comp2 i used method below: ComparerCollection(array_X, array_Y); but there are errors below. Arraylist generated from Ilist. how can i do that? namespace GenericCollecitonComparer { class Program { static void Main(string[] args) { myClass comp1 = new myClass() { ID ...

C# API generator

I have a few dll files and I want to export all public classes with methods separated by namespaces (export to html / text file or anything else I can ctrl+c/v in Windows :) ). I don't want to create documentation or merge my dlls with xml file. I just need a list of all public methods and properties. What's the best way to accomplish...

Initializing null variables in .NET

What is the proper way to initialize a null variable in .NET? I've been told by one of my colleagues that hard defining of a variable to null is a slowdown. int var1; // good practice string s1; // good practice int var2 = 0; // bad practice string s2 = null; // bad practice Is that correct? ...