.net

.NET performance tips for enterprise web appilcations.

Hi, For enterprise web apps, every little bit counts. What performance tips can you share to help programmers program more effeciently? To start it off: Use StringBuilders over strings since strings are Mutable (they get re-created everytime you modify them). Avoid using Datasets as they are very bloated, using SqlReader instead. ...

XML - Data At Root Level is Invalid

I have an XSD file that is encoded in UTF-8, and any text editor I run it through doesn't show any character at the beginning of the file, but when I pull it up in Visual Studio's debugger, I clearly see an empty box in front of the file. I also get the error: Data at the root level is invalid. Line 1, position 1. Anyone know w...

Differences between C++ and C#/.Net

If asked, how would you describe the differences between C++ and C#/.Net ...

Why would VS2005 be looking for a file it's supposed to be generating?

I'm working on a PocketPC app in Visual Studio 2005. The solution was building fine, then suddenly broke. The first error is this (assume the project is FooPDA): "Unable to find source file 'C:\FooPDA\obj\Release\FooPDA.exe' for file 'FooPDA.exe', located in '%InstallDir%', the file may be absent or locked." This error is rather conf...

reading a com port

I'm trying to interface with a cdc card reader which outputs to a virtual com port. How does one go about opening a stream to read from a com port? ...

Configuring security for a windows forms control hosted in Internet Explorer

I've created a windows forms control, which is hosted in a web page viewable with Internet Explorer. My control reads from a com port and it writes to the event log. Both of these operations by default fail when the framework requests proper permissions. This web application will always be running in the intranet zone, how do I enable...

c# performance: type comparison vs. string comparison

Which is faster? This: bool isEqual = (MyObject1 is MyObject2) Or this: bool isEqual = ("blah" == "blah1") It would be helpful to figure out which one is faster. Obviously, if you apply .ToUpper() to each side of the string comparison like programmers often do, that would require reallocating memory which affects performance. But h...

How do I access internal objects from hosted IronPython?

I'm hosting IronPython 2.0 in a C#/Winforms application. I would like Python to be able to access various global, static objects in the host application. As an example, the host application has an internal static class 'Global', which contains a number of static public members, which are are the various global objects I'd like to acces...

Hosting a complex online service

I have an idea for a web-based service. The implementation is very complex. There will be very few users, and the traffice will be fairly low, but the server-side code could require a lot of resources. Ideally I'd need to have as much control over the servers as possible. How should I arrange hosting for this, when it comes time to rele...

Whats the best tutorial / place for learning generics

I have a team of junior developers and they want to have better understanding and usages of generics. Anyone recommend good tutorial or articles samples that are good places to start. ...

File Access from Excel COM object fails when run from NT Service on Vista

We use COM objects to access excel spreadsheets in an NT service (via the Windows Scripting Host). Prior to Vista, this worked beautifully, but starting with Vista, we receive this error: Microsoft Office Excel cannot access the file 'c:\myfiles\test.xls'. There are several possible reasons: • The file name or path does not exist. • Th...

Contextual code generation in Visual C# 2008?

I type ArrayList memberNames = new ArrayList() { "Jim", "John", "George" }; and Visual Studio tells me "ArrayList" cannot be found so I have to manually go to the top of the file and type using System.Collections; Is there a way to get Visual Studio to do this automatically? In FlashDevelop, for instance, you press CTRL-SHIFT-1 a...

New Cool Features of C# 4.0

What are the coolest new features that you guys are looking for, or that you've heard are releasing in c# 4.0. ...

Determine if a reflected type can be cast to another reflected type

In .net (C#), If you have two types discovered through reflection is it possible to determine if one can be cast to the other? (implicit and/or explicit). What I'm trying to do is create a library that allows users to specify that a property on one type is mapped to a property on another type. Everything is fine if the two properties ha...

Wrapping Visual C++ in C#

I need to do some process injection using C++ but I would prefer to use C# for everything other than the low level stuff. I have heard about "function wrapping" and "marshaling" and have done quite a bit of google searching and have found bits of information here and there but I am still really lacking. Things I have read in order of u...

Modifying Excel spreadsheet with .NET

Here's the problem: I have to modify an existing Excel spreadsheet using .NET. The spreadsheet is hugely complex, and I just have to add data in some predefined areas. I'm investigating my options, and Excel Automation/InterOp is out of the question, as I'm implementing an ASP.NET website, and Excel probably isn't installed on the ser...

Extension method instead of Null Object pattern

I'm wondering to using extension method to avoid checking for null in hierarchy. The example: // GetItems(), GetFirstOrDefault(), GetProduct(), GetIDProduct() are extension methods like: public static SomeType GetSomeProperty( this XYZ obj ) { if ( object.ReferenceEquals( obj, null ) ) { return default( SomeType ); } return obj....

How to prevent ASP.NET 3.5 SP1 from overriding my action?

In my master pages I have <form ... action="" ...>, in pre SP1, if I viewed the source the action attribute would be an empty string. In SP1 the action attribute is overridden "MyPage.aspx?MyParams", unfortunately, this causes my postbacks to fail as I have additional pathinfo in the URL (ie. MyPage.aspx\CustomerData?MyParams). I have c...

Problems with HttpWebRequest/HttpWebResponse and cookies

Hello, I'm having troubles with HttpWebRequest/HttpWebResponse and cookies/CookieContainer/CookieCollection. The thing is, if the web server does not send/use a "path" in the cookie, Cookie.Path equals the path-part of the request URI instead of "/" or being empty in my application. Therefore, those cookies do not work for the whole dom...

Can I use ODAC 11g to access 10g

I am developing an application with VS208 for different Oracle versions. I am wondering if I need to install different version of ODAC to do this, or does the latest release has backward compatibility? Thanks in advance, ...