.net

IntPtr vs UIntPtr

This should be simple: I see everywhere people use IntPtr, is there any reason I should use UIntPtr, instead? ...

When working with process' memory, is there a reason to use uint instead of int?

I mean, from what I understand an int(Int32) will go from -2,147,483,648 to 2,147,483,647. If I recall correctly, every program under windows on 32bits will behave as it has 2gb of ram, so I'd say i can put any address "inside" an int32. Is that true? Or should I stick to uint? I know uint is only for positive integers, and that all memo...

Write html content in a mail using a stream

Hello, I have a stream loaded with HTML that I got from an export. I can take this html from the stream in a byte[] (is there any other way?), and I want to write this byte[] to a html mail body. The reason to do this is that I want to export a report to html, and use this data in the body of the mail, instead of exporting it to pdf an...

Use system namespaces for class libraries: good or bad

Hi, Is it a good idea to use "system namespaces" in my class libraries? Sample: namespace System.Web { public static class RequestExtensions { public static bool IsPost(this HttpRequest r) { return string.Compare(r.HttpMethod, "POST", StringComparison.OrdinalIgnoreCase) == 0; } } } The advantage...

Trying to find the top 3 properties of a POCO instance, Part 2

Hi folks, a month ago I asked this question: Trying to find the top 3 properties of a POCO instance. Got an answer, worked well. Now, I'm trying to find the top 3 properties of a POCO object (like my previous question) but where each property has a WEIGHT. The value of the property comes first. The weight then comes in second ... if tw...

Using reflection for generically typed delegate and interfaces

Hi, I have a bunch of classes that each have a property called Sequence. This property is implemented from an interface called ISequenced. For this example lets call one of these classes A. When I have a List(of A), I want to be able to sort them using the standard List.Sort(addressof delegate) where the delegate is a standard function ...

Graphics.Save vs Graphics.BeginContainer

How is Graphics.Save different from Graphics.BeginContainer? ...

Class, Interface, Generics .... need simplification

Hello, At this time, I have this piece of code for my "employee" class. But I have almost the same for "customer" and all the others. Is there a way to create an equivalent of my class "EmployeeRepository" but more something like this MyRepo<Employee> but implement IEmployeeRepository in this case, ICustomerRepository if I do this MyRe...

WSE 1.0 compatible with .net 3.5?

I'm currently upgrading my codes from .NET 1.1 to .NET 3.5 Along with my regular codes are my WSE 1.0 codes. I used the VS studio 2008 wizard to convert the codes into 3.5. I have not made any changes to the WSE 1.0 codes, in terms of changing its references. is WSE 1.0 compatible with .NET 3.5? or should i be asking, WSE1 upon conv...

Retrieving data from xml with respect to user input and user selecting from the list of input

I just started learning Visual Studio a couple of weeks ago and everything is way over my head. Can you please give me a copy of the code I'd use to format both a date column and a price column? I am also not seem to be getting the gridview to show the checkbox. I'm stuck pls help. I am using visual studio 2008 and would want to pull out...

Keyboard focus vs logical focus in WPF

What is the difference by Keyboard focus and logical focus in WPF? and how WPF focus is different from the focus in winform ? ...

How to use ConfigurationManager for DEBUG dn RELEASE versions in VS 2008 projects

Hi, i would like to use the "ConfigurationManager" settings, that i can create in VS 2008 ( see image ), to create different behaviors in my web.config or app.config files... for example i want to use different connection strings, if the "debug"-configuration is active, like: <configuration> <connectionStrings configSource="connecti...

How to convert a simple .Net console project a into portable exe with Mono and mkbundle?

Hello, I'd like to convert my simple pure .Net 2.0 console utility into a portable exe which I could just put on an USB stick and run without having to worry whether the CLR and framework libraries are installed on a particular machine or not. Stackoverflow already has some information on using Mono and Mkbundle for creating self-con...

configuring log4net with xml file

Hi I tried to configure log4net for logging everything to the console output. I have a config file nameed Log4Net.config <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> </configSections> <log4net> <appender...

Javascript to extract value of each checkbox in checkboxlist

I have 5 check box lists, which all are selectives, which are criterias which need to be chosen in order to create filters. What I need is to have something like this, after selecting items from the check box lists, just for the user to have an idea what he or she has chosen "You have chosen countries - United Kingdom, Africa" "You hav...

Why choose a static class over a singleton implementation?

The Static Vs. Singleton question has been discussed before many times in SO. However, all the answers pointed out the many advantages of a singleton. My question is - what are the advantages of a static class over a singleton? Why not simply choose a singleton every time? ...

Threaded event handling (C#)

Hi community, I have a question about event handling with C#. I listen to events a class A throws. Now when the event ist thrown a method is executed that does something. This method sometimes has to wait for respones from datasources or similar. I think event handling is synchronous so one after another event will be processed. Is it ...

What is the role of public key token?

What is the role of public key token? Does it have any part in decrypting the signed hash. In GAC, why is there so many assemblies from Microsoft with the same public key token?. ...

Redirect writes to a file to a stream C#

Hello, I wanted to ask if it is possible to redirect writes to a specific file, to a memory stream in my application so I can immediately read it. If it is possible please explain how to do so. Thanks. ...

Problem With WPF Application And SQL Server Database

I made an application with animations in WPF with Visual Studio 2008 Team System and SQL Server 2005. So I have Windows XP and Windows 7, in Windows XP that I have Visual Studio and SQL Server and Framework 3.5 it works very well, but in Windows 7 and in other computers it can not connect to database, first I thought it's about Framewor...