.net

DataContractSerializer C# Can serialize, cannot deserialize, why?

Hi, I have application created using WCF and C#, it's architecture requires to add KnownTypes through App.config. I have services going like this: Client -> CentralServer -> DataServer (where -> is WCF connection) Now, I've added KnownTypes to both CentralServer App.config and DataServer App.config this way: <add type="Odra.Server.Ce...

Large file handling - Read algorithm breaks - C#

So I've got an algorithm that reads from a (very large, ~155+ MB) binary file, parses it according to a spec and writes out the necessary info (to a CSV, flat text). It works flawlessly for the first 15.5 million lines of output, which produces a CSV file of ~0.99-1.03 GB. This gets through hardly over 20% of the binary file. After this ...

Format DataGridView Cell without changing underlying value?

I have an unbound DataGridView (in VS 2008), of which one column contains a file path. I'd like to format the string using the TextRenderer class on the ColumnWidthChanged event without actually modifying the underlying value. The problem is that the contents of the table are saved when the form is closed and I don't want to save the for...

Is it possible to exclude some members of a type from XmlSerializer serialization?

I have some public members I don't want to be serialized, was wondering if there is an attribute for it? ...

How to clear graphics on a transparent control in windows forms

So, I am pretty unfamiliar with windows forms development. I'm trying to create a "hey I'm busy doing stuff" component that just spins a shape around. I want this control to be transient and draw on top of any other controls. The class inherits directly from Control. So I have this in the constructor: SetStyle(ControlStyles.Opaque, tr...

How to use a C++ module from a Mono app

I'm trying to run my C#/C++ app on Linux after developing it on Windows. A small part of it, FooLib, is written in C++ which is pinvoked from C# for performance. FooLib uses no system calls, only standard C++ functionality. It exports a single function, declared as: extern "C" __declspec(dllexport) void Foo(float*, int, float*); It's...

Customising ASP.NET Dynamic Data Operations

Where can I intercept reads and updates for scaffolded tables? I need to make certain records or fields read only to certain people and or after a certain date? I also have a Departments list, where clicking a department brings up a list of Categories for that department. I need to block access to the Department list to normal users, ...

Memcached .NET Clients Comparisons

Hi, I'm looking for a .NET Memcached Client, I founded 3 clients libraries. Anyone have pros and cons about theses clients ? MemcachedDotNet BeIT Enyim Thanks. ...

What would you like to see in a generic ToString function?

Lets say you have a generic function called "SafeToString". The purpose is to be able to pass anything in and always get back a sane response without any exceptions. How would you want it to respond to these inputs? Null -> Null or String.Empty DBNull.Value -> Null, String.Empty, or some text like "" Nullable containing a null -> Null,...

Visual studio like panels

Hello, I need to make some vertical docking/collapsible panels in the style of the Visual Studio IDE (like Solution explorer, Toolbox, Properties, etc...), does anyone know some examples or code for doing that? Thanks, R. ...

C# - Find all email addresses for an Active Directory user

I'm trying to get all the email addresses associated to a given AD user. For the user I have the domain and the login name (ex. DOMAIN\UserName) and I the AD is storing the email addresses in: The mail attribute. In proxyAddresses attributes. So far, I don't know what C# API to use to connect to the AD, and how to properly filter by...

Why is .NET Sql Server access faster than Excel Interop?

This might be a loaded question, and it might get voted down, but it completely frustrates me. When you use SQL Server in your development the data access is fast and efficient, but when you use COM to talk to Excel it is piggy slow. It doesn't matter what data access technology you use, ADO, ADO.NET, LINQ, Entity Framework, Astoria (A...

WCF ConcurrencyMode.Multiple Connection best practices and Caching

I've got a WCF service with the following settings: NetNamedPipeBinding ConcurrencyMode.Multiple InstanceContextMode.Single Now I've got a client that accesses to this WCF service in a multi-threaded fashion. As far as I understand I have to open a new connection to the service for each thread to avoid threads to block each others. ...

getting keyboard events without the window being focused

i want to get keyboard events without having focus. my application is a background application and should send "space" key to another app when user presses CTRL+space in any application. i use .NET and i use C# as language. ...

How can a .net program update itself?

I've written a program that updates itself if it finds a newer version on a server but I'm finding it hard to implement cleanly. Checking a remote server and downloading the file are easy enough but then what? It can't simply File.Copy("newversion.exe","myprogram.exe") because myprogram is running and the file is locked. I do it by dow...

Getting the device's CPU utilization and free RAM on WinCE in C#

I'm looking for alternative ways of obtaining the total CPU utilization percentage and the amount of free RAM on the device in C#. There is an extremely easy solution described here: http://zamov.online.fr/EXHTML/CSharp/CSharp%5F927308.html However, the PerformanceCounter class is not included in the .NET Compact Framework 3.5. Are th...

How does .NET/Mono performance compare to JVM?

I've been wondering this for a while. Please give quantitative data to support your answer. Related: Is there a significant difference between Windows, Mac, and linux JVM performance? ...

Complex string matching with LINQ to Entity Framework

We are using LINQ to EF to develop a solution. In my LINQ query I would like string toMatch = "Matt Cool"; newString = toMatch.Replace(" ", "% ") + "%"; // So here newString is 'Matt% Cool%' /*Now in my datasource, there is no 'Matt Cool', there's 'Matthew Coolguy'. I would like this query to return that result. I would expect th...

Placing Business Rules inside a Repository

I have a table that is storing a list of rules. In my code, I need to retrieve those rules and maintain the list of rules (via. the Repository Pattern) so that I can reuse them. I then need to generate(business logic) a list of objects based on the rules for a particular period of time, eg, a list of holiday objects filtered by the rul...

Is there any framework for .NET to populate test data?

I am use c# and for unit testing and integration testing usually I need to populate fields automatically based on attributes. Lets say we will test if we can write and get back user data to database. I create a user object populate fields write user to database Read user object from database Check fields if what I write is same a...