.net

What is the right way to enumerate using LINQ?

Code: var result = db.rows.Take(30).ToList().Select(a => AMethod(a)); db.rows.Take(30) is Linq-To-SQL I am using ToList() to enumerate the results, so the rest of the query isn't translated to SQL Which is the fastest way of doing that? ToArray()? ...

Crystal Reports -Invalid Argument provided. Failed to open a rowset. ADO.Net xml

Okay here is the scenario I have a VB6 application that is getting re-written for asp.net 3.5. I have a grundle of Crystal Reports that are getting updated to Crystal Reports 10.5 (which is included in Visual Studio 2008). All of the old reports used OLEDB. What I am doing is taking the sql statements used in the reports and putting t...

Custom C# / .NET Code Analysis

What kind of a tool could examine source or assemblies and tell if StringBuilder was ever used? or if the ObjectDataSource was used? I'm open to source analysis or reflection, but also need to know the right way to do this against Web Applications. UPDATE: I guess I'm looking for a tool that you could insert into a build process that w...

Using EntLib logging app block to send email using auth/secure smtp server

The entlib logging application block doesn't allow for setting username/password or useSSL in the EmailTraceListenerData config type, is there a common solution for this? ...

Reusing code in .NET website (app_code folder)

I need to use some classes inside the app_code folder of a website project in visual studio 2008. I need to access this code from a class library project in the same solution. I cannot add a reference to the website, and I'm not sure of the easiest way to use the classes that already exist here. Do I need to move it to a class library...

StreamReader.ReadLine and CR

Am I being dense here? StreamReader.ReadLine states that: A line is defined as a sequence of characters followed by a line feed ("\n"), a carriage return ("\r") or a carriage return immediately followed by a line feed ("\r\n") So, why doesn't this work as expected? ' Server Dim tcpL as New TcpListener(IPAddress.Any, 5000) tcpL.Sta...

Deploy my DLLs to GAC for use with ClickOnce App

How do I do it? Is there any reason I shouldn't? I have a winform ClickOnce App that has about 13mbs in DLLs that are not mine so I would have no need/ability to update them at any regular intervals. DevExpress(3), Microsoft ReportViewer, Microsoft SQL Replication. Microsoft SQL SMO. Without them being included in my ClickOnce App ...

Analyzing code structure using CodeDom??

Hi, I recently wrote a post here on Stackoverflow asking for some C# libraries that calculate metrics, mainly CC...unfortunately with no success. So I'm going to write it myself. I did a search on the web of what could be the best approach, but before starting I'd like to ask you on how you'd do it. I'm currently between two kind of ap...

Can't receive serial data in .net 2.0, using rs232 to rs485 converter

I've done a good deal of RS232 work using the .Net 2.0 serialport class. I've never had trouble with it, until today. I'm communicating with a piece of company hardware that uses the RS485 protocol. I'm using an RS232 to RS485 converter device from B & B electronics. I can send data just fine, and see it received on the other side. ...

Editable multicolumn primary key with ASP.NET's GridView and SqlDataSource

I have a table TaskSchedule. It has a three-part primary key and two more values: IdTask PK IdPerson PK StartTime PK EndTime Remarks IdTask and IdPerson are also foreign keys. The idea is that you can write down which person worked on which task in which period of time. We suppose that those three stuff will be sufficient to specify u...

How to select nodes with XPath in C#?

Hey all, Simple question, I just want to select the text from the <Template> tag. Here's what I have, but the Xpath doesn't match anything. public static void TestXPath() { string xmlText = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"; xmlText += "<Properties xmlns=\"http://schemas.openxmlformats.org/officeD...

Major differences between J2EE and C#/.Net when developing Web Services

Having been primarily a .NET guy up until starting a new job recently; I've only done Web-Service development and consumption in C#/.Net. However I'm embarking on the journey to learn the ins and outs of doing it on the J2EE platform, and I'm curious what the major differences are in this specific type of development. Note: I have famil...

C# - How to detect the currently pressed key?

In WinForms, you can know, at any time, the current position of the cursor thanks to the Cursor class. The same thing doesn't seem to be available for the keyboard. Is it possible to know if, for example, the Shift key is pressed? Is it absolutely necessary to track down every keyboard notification (KeyDown and KeyUp events)? Thank yo...

What is the correct way to implement the NUnit 2.5 Constraint.Write*() methods?

Hello: I'm planning to implement my own set of constraints, and am having some difficulty understanding how to implement the following methods of the Constraint class. public abstract class Constraint { public abstract void WriteDescriptionTo( MessageWriter writer ); public virtual void WriteMessageTo( MessageWriter writer ); ...

What are the pros/cons of 64 bit .NET?

As mentioned in this question/comments there are certain disadvantages when moving from 32 bit .NET to 64 bit .NET. Probably the biggest advantage is the much bigger process address space in the 64 bit world, but what other pros and cons are worth noting? ...

SortedList that just takes IComparable<T>

I have an interface IScriptItem that implements IComparable<IQueueItem>. In my eyes it would seem enough to have IComparable items in order to have a sorted anything. But all I can find is Dictionaries, Hashtables and SortedLists that are actually SortedTrees. What I'm looking for is a sorted generic list that takes IComparables. Am I l...

Add Items to a ASP Repeater from a Custom Queue Container

I want to use an asp repeater to generate the html for the items I pull back in a custom class Queue. In other words Queue x = otherClass.getCustomClassObjects(); And then bind this to a repeater. And on the OnRepeaterItemDataBound assingn the html values appropriately to what is in the queue. Is this possible ? ...

Installing native assembly into GAC

Hello, I have an assembly containing a mixture of Managed and unmanaged C++ code. I have signed it and installed into Global Assembly Cache. My program (.Net, C#) won't find it there, although it worked perfectly well when the assembly was in the program directory. The program uses DllImport and pinvoke to call the methods from the asse...

How to Design a Program to Perform Complex financial calculations with .NET

Alright, I hope this isn't too broad a question but my curiosity got the better of me. I'm working for a large insurance company. We are building excel spreadsheets that handle projection of future cash value for life insurance policies. These are pretty large workbooks(40-50mb) with a ton of sheets and columns that have to take an asini...

how to insert 61000 data objects into sql server 2005?

I am trying to insert 61,000+ objects, obtained via a remote call, into a SQL Server 2005 database in the fastest method possible. Any suggestions? I have looked at using SQLBulkCopy, but am having a few problems working out how to get the data into the right format since I am not starting with a DataTable, but instead have a list of ob...