.net

Is there any special difference between an exe an dll from .net standpoint?

I have in the past used .net executables as libraries. I'd just add them to the references in visual studio and I was ready to go. Today I tried the same to a new exe (actually mine) and it doesn't seem to work. When I add it to Visual Studio and try to watch its members on the Object Browser, it doesn't show up anything inside that exec...

Really impossible to use return type overloading?

I made a small DLL in MSIL with two methods: float AddNumbers(int, int) int AddNumbers(int, int) As some of you might know, MSIL allows you to make methods that have the same arguments as long as you have different kinds of return types (what is called return type overloading). Now, when I tried to use it from c#, as I was kinda expec...

.net ContextMenuStrip with Sub-Items, MouseLeave behavior

I have a TreeView with ContextMenuStrip's on each node of the tree. This works well. I wanted the ContextMenuStrip to close when the mouse left it. I accomplished by using a sub that is triggered by CMS.MouseLeave and this works well. Now I would like to add sub-items to the items in the menu. I have this working BUT MouseLeave is ...

C#/.NET - How to trigger update of listview from another thread

It seems I'm forbidden to access (i.e. update) my list view control from another thread than the main thread. How can I perform some threaded task and then signal somehow to start the update of the listview? ...

What is the easiest and most compact way to create a IEnumerable<T> or ICollection<T>?

So, many times we have a function that accepts an IEnumerable or ICollection as a parameter. In cases where we have single items, but no collection to hold them, we must create a collection before passing them to the function, like: T o1, o2, o3; Foo(new T[] { o1, o2, o3 }); I've always created an array or a list, like I've done in th...

wont save to database with guid as id- fluent-nhiberate

hi. i got problems with saving when i use Guid as identifier. can anybody se what i am missing here? i create my own guid so i dont want it to be generated by database. NOTE: i have tried the guid.combo in mapping to without any success. public class Order { public virtual Guid Id { get; set; } public virtual ICollection<Orde...

Printing text with different font sizes on the same page

I'm trying to determine how I would utilize a generic list to print out text with various size fonts. I know I would have to loop through the list to send the object to the Graphics.DrawString(String, Font, Brush, PointF) method. I'm just having trouble as how to set the objects in the list so I can loop through and print them. I...

WebClient.UploadProgressChanged Event issue

Hello everyone, I am using VSTS 2008 + C# + .Net 3.5 to develop a console application to upload a file to server. I want to show upload progress. I want to use WebClient.UploadProgressChanged Event, but confused about its function -- "Occurs when an asynchronous upload operation successfully transfers some or all of the data." My confus...

See data in gridview in ASP.net with Linq

hi I want to show data in my database with Linq in gridview but I can't do it. this Code : var o = (from i in MDB.Messages select new { Subject = i.Subject, Message_Code = i.ID_Message, Question_date = i.Date, Question_Name = i.aspnet_Membership.aspnet_User.UserName }); EndInboxGrv.DataSource = o; How do I solve t...

Failure to use AppDomain from COM interop

I've a piece of .NET code that for various reasons (reliability, deployment) must run in a separate AppDomain. I've created a proxy object deriving from MBR that delegates the calls to the real stuff so it wont load in the current AppDomain. I create the proxy via the usual CreateInstanceAndUnwrap. this.eDirectCommunication = (EDirectCo...

Entity Framework V4: "Code Only" performance considerations

I'm about to start working on a new project and am wondering if "Code Only" is the right way to go. We're also considering the other model-first approach through the designer, but would rather design my domain models outside of the EF designer. Our domain will likely contain 100+ entities. I've read that a huge number of entities can ...

Should I force exceptions to test them ?

i have this method in my data access class and i have a unit test to make sure it does work properly, but my test doesn't test the exception so my question is should i create a new test to force the exception to be raised or should i just trust that the catch block will work just fine in case of an exception ? is it worth the effort ? h...

C# Interrupting native threads

Hello *, I am currently investigating how Thread.Interrupt plays together with P/Invoke or native calls. I have read in MSDN that it is not possible to abort (Thread.Abort) a thread which is in the native call (other use cases might apply as well). But I did not find any reference which states the same for native threads which are in Wa...

how i can fill collection from database and connect this collection to ComboBox ?

hi how i can fill collection from database and connect this collection to ComboBox ? thank's in advance ...

how to install microsoft .NET client profile of 30 MB size ?

Hi, i have a host pc(Vista) and virtual pc(XP). ON my virtual pc i dont have .NET framework, only Visual studio 2008. On my host pc i have Vs 2008 SP1 with all of the .NET framework components. In Prerequisite window, "Choose which prerequisite to install" i have only checked .NET Client profile. When i am using a click once ins...

Tutorials on Open Packaging Conventions / System.IO.Packaging

Has anyone seen a good tutorial on Open Packaging Conventions and the System.IO.Packaging namespace? I have some areas where I think this technology could be useful, but I'm nervous because I don't quite understand it and I'm stuck on some of the terminology. ...

Why does the runtime shows the generic types as "GenericType`n"?

And why doesn't it shows the real type (eg: List<string> instead of List`1)? Where does this strange (to me) notation comes from? ...

How to attach a debugger at process creation?

I would like to debug a .NET application that fails immediately on startup (and exists without an error message or log), but I can't attach a debugger to it because the process exists almost immediately after I run it. I don't have the source code for the app, so I can't do "Start Debugging". I tried using a Visual Studio macro to start ...

Iterating through a Enumerable collection with nullable types

Hey, I'm trying to iterate over an Enumerable collection of mix of nullable types However I want to compare the nullable type with a intrinsic type such as string or decimal. i.e. Here is a snippet <% foreach (PropertyInfo prop in this.Columns) { %> <td> <% var typeCode = Type.GetTypeCode(prop.PropertyType)...

What happens if both catch and finally blocks throw exception?

What happens if both catch and finally blocks throw exception? ...