.net

How can we implement observer pattern in .NET?

In .NET architecture,there are lot of design patterns.I want to know about what is meant with observer pattern and how it is implemented ...

Exclude whole files based on configuration from build in VS2008

I have three different configurations on my project, all three do not require all files to be build into the application. Actually I'd prefer if I could exclude those files from the build, which would make my application a little more lightweight. What I'm looking for is #if MYCONFIG or #if DEBUG statement but for files. I've already re...

Are there any alternatives to using List.Single to get an element with a primary key?

I have a List of User objects from my data store. Now once it is already in memory the only way to get a user by his ID is to use the Single extension method. This is really performance degrading. I know I could have used a dictionary instead of a list but this would be redundant. I would have to store the Primary Key 2 times. So is t...

SocketException: address incompatible with requested protocol

I was trying a run a .net socket server code on Win7-64bit machine . I keep getting the following error: System.Net.Sockets.SocketException: An address incompatible with the requested protocol was used. Error Code: 10047 The code snippet is : IPAddress ipAddress = Dns.GetHostEntry("localhost").AddressList[0]; IPEndPoint ...

Generic BitConverter.GetBytes possible in .NET?

Is it possible to create a method like BitConverter.GetBytes() that accepts as input also a parameter of type Object, without using Marshaling as done here? Or the only solution, if a type Object is given as input, is to implement a case on all available .NET value types? ...

What is the difference between configurations of “Web farms” and “Web gardens”?

What is the difference between Web Farms and Web Gardens, related to the server configuration section in .NET? How can we implement it? ...

How to find all the browsers installed on a machine

How can I find of all the browsers and their details that are installed on a machine. ...

Have you had problems developing on a Virtual PC?

I use a virtual PC (with remote desktop connection) for my project. The project uses some GDI+ functionality. Now, apparently there is a problem when displaying graphics object on the real and virtual PC. A simple example: public class Form1 : Form { private void Form1_Paint(System.Object sender, S...

How to get Complete list of available Datasets in a Project (VS)

I want to get a list of all available datasets (that I'd creat in my Asp.net project) After that I want to select a Dataet from the list and get The list of Available DataTable included in that Dataset. Finally I should b able to check all Data Tables Fields How To Do This ? Note that I know VS already has a dataset Panel but that...

What is the correct method used to encrypt the SOAP header?

I know that the SOAP Header is used to transmit auxiliary information relevant to the Web Service processing that isn't part of the method signature.I want to know how to encrypt SOAP message header. ...

Why doesn't every class in the .Net framework have a corresponding interface?

Since I started to develop in a test/behavior driven style, I appreciated the ability to mock out every dependency. Since mocking frameworks like Moq work best when told to mock an interface, I now implement an interface for almost every class I create b/c most likely I will have to mock it out in a test eventually. Well, and programmin...

About using arguments passed to checkedChanged event of Checkbox

Hello to all, I want to display value of "text" property of checkbox when it is clicked. So with checkedChanged event 2 arguments of type sender & eventArgs are passed. So can anybody get me know how to do the same using these arguments. ...

Why does MethodInfo.Invoke wrap exceptions in a TargetInvocationException?

I'm asking this out of curiosity rather than due to a real need to know, but I can't think of any good reasons for MethodInfo.Invoke to wrap its exceptions. Were it to let them pass unwrapped, debugging such exceptions in Visual Studio would be a tiny bit easier - I wouldn't have to ask VS to stop on first-chance exceptions to see the c...

How to change master page value from child page.

I want to change master page some label value from child page. ...

convert c# code files to one html file/s?

Hi How i can convert to c# code files to html files?Is there any generation tool? I need it my presentation... ...

Validating an Entity Attribute C#

I have a Person and an Organisation Entity: Person looks like this: public class PersonEntity { public string FirstName {get;set;} public string LastName {get;set;} public bool IsValid(PersonEnum Attribute, string AttributeValue) { if(attribute == PersonEnum.FirstName && AttributeValue == null) return false; if(attribute == PersonEnum....

Using MySQL GeoSpatial Data Types in .NET

I'm looking for information on how to use MySQL geometry types in .NET. I'm using Sub-sonic for ORM, and don't really need to support much more than MySQL's POINT type. The MySQL .NET connector seems to return point data as a byte[] array in OpenGIS WKB format. What libraries are recommended for working with this WKB format? Alte...

How to call method written in VB.NET from C# with optional arguments

Hi, I have a method written in VB.NET. It looks like this: Shared Sub SomeMethod(ByVal Id As Guid, Optional ByVal str1 As String = "foo", Optional ByVal str2 As String = "") I want to call this method from C# 3.0 and I want it to use its default arguments. I tried passing System.Reflectio...

Loading XHTML schemas to XmlSchemaSet

Hello, I'm trying to load the XHTML schemas from the W3C site (xhtml - transitional, strict & frameset) which I'm having to put into to an XmlSchemaSet. This is then used by a third party product in our application to show intelisense and validation. However when I try and "Compile" this XmlSchema set I get the following message: Th...

how to change desktop screen resolution.

I want to change screen resolution with c# code in desktop application. ...