.net

How did Microsoft create assemblies that have circular references?

In the .NET BCL there are circular references between: System.dll and System.Xml.dll System.dll and System.Configuration.dll System.Xml.dll and System.Configuration.dll Here's a screenshot from .NET Reflector that shows what I mean: How Microsoft created these assemblies is a mystery to me. Is a special compilation process requir...

Does every type in .net inherit from Sytem.Object?

This might be a very basic question. But, I am a bit confused about it. If I reflect the Int32/Double/any value type code, I see that they are structs and look like : [Serializable, StructLayout(LayoutKind.Sequential), ComVisible(true)] public struct Double : IComparable, IFormattable, IConvertible, IComparable<double>, IEquatable<doubl...

BLOB data to simple string in DataGridView?

I am using C# & MYSQL to develop a desktop application. In one of my form I have a DataGridView (dgvBookings) and in my database table I have a table tblBookings which contains a field specialization of type BLOB. I am selecting data with following query, SELECT * FROM tblBookings WHERE IsActive=1; and then binding the data with Da...

Are there any design patterns used in the .NET Framework?

I would like to know: are any GoF design patterns are used in the .NET Framework? BOUNTY: I have seen the MSDN link below in an answer. Are there any post/video or can you can list patterns and most importantly WHERE it is used? ...

Regular expression to check if a given password contains at least one number and one letter in c#?

Can anyone help me write a regular expression for checking if a password has at least one letter and one number in it? I have a requirement that users passwords must be alphanumeric and I want to be able to check for that using a regular expression. ...

Sql Server Compact Edition database deployment strategy

Hello, I have a question about the most appropriate way to deploy a SQL Server CE database with our client application. I understand we need to install the SQL Server CE prerequisites etc., so this isn't a question about getting it to work. It already does. Right now the way we have it is that we just ship a copy of the .mdf file (co...

winform application exception DragDrop occurs outside of IDE

hello, My winform application is failing when run outside of the IDE with a dragdrop exception. The error does not occur while being run from inside the ide (VS2008). How can I trace this. I have seen mention of using JIT in the error box that is displayed post error - will this help me trace my problem? ...

C#: Get complete desktop size?

How do I find out the size of the entire desktop? Not the "working area" and not the "screen resolution", both of which refer to only one screen. I want to find out the total width and height of the virtual desktop of which each monitor is showing only a part. ...

Stream as an Attachment to System.Net.Mail is 0 bytes

I've got a project where I'm using a PDF generator to send a file to a user. We'd like to give the user the option to attach this file to an email instead, and we're having trouble using the Stream object and Attachment logic together. We start with ABCpdf, which has two save methods: it can save to a Stream, or if you give it a string...

Can I use a has-many-through style association with the ADO.NET Entity Framework?

I have 3 objects in my model thus: Customer 1-----* Region 1-----* Branch To get the Customer from the Branch in code seems simple enough: branch.Region.Customer I would need to get all of the Branches belonging to a given Customer though and suspect that customer.Regions.Branches would not work due to customer.Regions being a col...

Need help with sending email using a godaddy account.

Hi, I'm trying to send an email using my godaddy hosting. I've also given away the username and password (as you can see in the code) for the testing email account so if anyone has the time, can they try and send an email using these settings? I'm totally at a brick wall. I've got Thunderbird setup and it connects and sends emails fin...

Dynamically extending a type at runtime?

I have the need to extend instances of various types at runtime. Most of the time, I need to work with instances of the original type, however in a few circumstances, I need to create kind of an extension-wrapper around those types that add a couple pieces of contextual information. Something along the lines of the following (which is no...

.NET CLR InternalCall

Is there a way to host the .NET CLR runtime and register MethodImplOptions.InternalCall functions? (This is not a topic about P/Invoke) ...

How do I test an exception that is only thrown when the system path is wrong?

I have the following class in C# which creates an object from a propriatery .DLL that requires a license in a reachable directory at the initialization . public CplexServices{ private Cplex _cplex; public Cplex Cplex { get { return _cplex; } } public CplexServices() { try { _cplex = new Cplex(...

Regular Expression to check max of 2 digits,max of 4 alphabets in a alphanumeric string of length 6?

It should match all the following examples. aBCd22 a2b2CD 22aBcD ...

What is <client> element of app.config ?

Hello All, What is <client> element of app.config ? Why it's added to client side when i add service reference? How can i access this element programmatically ? ...

Non-Data Classes Part of Model?

Are non-data classes (that are not representing anything in the database) still considered a part of an application's domain model or not? Would you put them together with your Linq2Sql domain model or somewhere else?? Edit: Info about classes: For example, I have a "StatusMessage" class which is instantiated under certain circumstances...

Access Repository through Service or directly?

Hello, is it a good coding standard to allow ASP.NET MVC controller actions to access a repository directly (even though a service layer is present for the heavy lifting, e.g. LoginService.Authorize() ) to retrieve, add, or update data? Or should everything go through the service, and from there to the repository? ...

Seekable alternative to .NET's CryptoStream?

Does anybody know a seekable alternative to .NET's CryptoStream? It is OK if the alternative supports Seek only in "read" mode or if it is limited to e.g. AES256. ...

C# validating data in multiple text boxes?

I have a C# form with multiple text boxes. Before proceeding I need to validate the inputs in the each text box. If my validation rule for each text box is same, Do I have any way to apply the same rule for all the fields at once. And my desired output is same. (I want to change the backcolour of the relevant textbox into pink) I mean I ...