.net

How do I allow assembly (unit testing one) to access internal properties of another assembly ?

I would like my Core assembly to not expose a certain class and I would still like to be able to test it. How can I do that ? ...

What .NET reporting tools are best for dynamic report generation?

Perhaps I need to define "dynamic generation". By this I mean using graphics primitives to draw on the page (such as DrawText or DrawLine, etc) This is what System.Drawing.Printing provides. I often need to create forms and reports for Windows applications that either require dynamic generation or where I need control over the formattin...

Options for PivotTables in Excel

I need to design a small project for generating excel reports in .NET, which will be sent to users to use. The excel reports will contain PivotTables. I don't have much experience with them, but I can think of three implementation alternatives: Set a query for it, populate it, send it disconnected. This way the user will be able to g...

Getting a list of assemblies needed by application

Is there a way of getting all required assemblies (excluding the .net framework) for a .net project into a folder ready to be packaged into an nsis as setup file? I've tried writing a small console app that uses reflection to get a list of dlls but have got stuck with finding a foolproof way of determining if a dll is from the .net fram...

.NET path manipulation library

Does anyone know of any good library that abstracts the problem of path manipulation in a nice way? I'd like to be able to combine and parse paths with arbitrary separators ('/' or ':' for example) without reinventing the wheel. It's a shame that System.IO.Path isn't more reusable. Thanks ...

Determining if an assembly is part of the .net framework

How can I tell from the assemblyName, or Assembly class (or others like it), whether an assembly is part of the .net framework (ie System.windows.Forms)? So far I've considered the PublicKeyToken, and CodeBase properties, but these are not always the same for the whole framework. Edit: The reason I want this info is to get a list of ...

How to check if a given user is a member of the built-in Administrators group?

I need to check programmatically (in .NET) whether a given user (domain account) is a member of the built-in Administrators group on a current computer (the one where the application gets executed). Is it possible? ...

What is the real overhead of try/catch in C#?

So, I know that try/catch does add some overhead and therefore isn't a good way of controlling process flow, but where does this overhead come from and what is it's actual impact? ...

Updating Legacy Code from System.Web.Mail to System.Net.Mail in Visual Studio 2005: Problems sending E-Mail

Using the obsolete System.Web.Mail sending email works fine, here's the code snippet: Public Shared Sub send(ByVal recipent As String, ByVal from As String, ByVal subject As String, ByVal body As String) Try Dim Message As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage Message.To = recipen...

How can you determine what version(s) of .NET are running on a system?

What are the different ways (programatically & otherwise) to determine what versions of .NET are running on a system? ...

IQuery NHibernate - does it HAVE to be a list?

Can I return it as an object if I'm doing a Select OneItem from Table Where OtherItem = "blah"? Is there a better way to do this? I'm building a constructor to return an object based on its name rather than its ID ...

What does the PDB get me while debugging and how do I know it's working?

I have to use a third-party component without source code. I have the release DLL and release PDB file. Let's call it 'CorporateComponent.dll'. My own code creates objects from this DLL and calls methods on these objects. CorpObject o = new CorpObject(); Int32 result = o.DoSomethingLousy(); While debugging, the method 'DoSomethingLous...

Perform token replacements using VS post-build event command?

I would like to "post-process" my app.config file and perform some token replacements after the project builds. Is there an easy way to do this using a VS post-build event command? (Yeah I know I could probably use NAnt or something, looking for something simple.) ...

Should I derive custom exceptions from Exception or ApplicationException in .NET?

What is best practice when creating your exception classes in a .NET solution: To derive from System.Exception or from System.ApplicationException? ...

C#: How do I get the path of the assembly the code is in?

Is there a way to get the path for the assembly in which the current code resides? I do not want the path of the calling assembly, just the one containing the code. Basically my unit test needs to read some xml test files which are located relative to the dll. I want the path to always resolve correctly regardless of whether the tes...

.NET Production Debugging

I've had a Windows app in production for a while now, and have it set up to send us error reports when it throws exceptions. Most of these are fairly descriptive and help me find the problem very quickly (I use the MS Application Exception Block). On a few occasions I have reports that are issues that I can't reproduce, and seem to onl...

Sorting Directory.GetFiles()

System.IO.Directory.GetFiles() returns a string[]. What is the default sort order for the returned values? I'm assuming by name, but if so how much does the current culture effect it? Can you change it to something like creation date? Update: MSDN points out that the sort order is not guaranteed for .Net 3.5, but the 2.0 version of ...

How do I create tri-state checkboxes with a TreeView control in .NET?

I have a treeview control in a Windows Forms project that has checkboxes turned on. Because the treeview control has nested nodes, I need the checkboxes to be able to have some sort of tri-mode selection. I can't find a way to do this (I can only have the checkboxes fully checked or unchecked). ...

GUIDs in a SLN file

Visual Studio Solution files contain two GUID's per project entry. I figure one of them is from the AssemblyInfo.cs Does anyone know for sure where these come from, and what they are used for? ...

Enterprise Library Application Blocks OR Home Grown Framework?

We are currently looking to adopt some type of "standard" developer framework and have looked into using the Enterprise Library. Would you recommend using these blocks as the foundation for software development, or should we do something home grown? ...