.net

Why is System.Windows.Shape.Path sealed?

I was trying to extend the shape class to contain an additional variable but have found the class is sealed. How can I achive this simply, using an alternate implementation approach? Is creating a new class and storing a shape an passing all the method calls through the easiest approach; I'm sure there is a better way though? ...

Using Linq, order objects by some property and select the first 2 objects

Using a linq query/method chainging I wish to select just the first 2 Point objects in a List ordered by Point.X. How can I? ...

owner drawn grid - .NET

I would like advice on whether or not I should program the following from scratch myself or use a 3rd party component. If there is a 3rd party component that fits the bill without too much baggage I'd appreciate recommendations. I would like to have a component that is a matrix of cells, like a grid control. I need no editing, no select...

how BinaryWriter.Write() write string

I used BinaryWriter.Write() to write string, the msdn said when writing the string, it is said like this Writes a length-prefixed string to this stream in the current encoding of the BinaryWriter, and advances the current position of the stream in accordance with the encoding used and the specific characters being written ...

SQL Server connection count issue

Hello everyone, I am using SQL Server 2008 Enterprise + .Net 3.5 + C# + ADO.Net. I am using the following SQL statement to monitor connection number, is it correct? If yes, my confusion is, one connection from ADO.Net client maps to only one connection in the following statement? Or one ADO.Net connection could maps to multiple connecti...

How can I add this stuff up that is coming from a database?

Hi Say I have this in my database courseName : English101 Mark : 80 OutOff : 100 Weight : 50 CourseName : English101 Mark : 30 OutOff : 50 Weight : 10 CourseName: Chem101 Mark : 100 OutOff: 100 Weight : 100 Now I want to find the over all grade for both of these courses First english101. (80 /100) * 50 = 40(achieved weight) (30 ...

Naming guidelines with C#

Hello! I have this class: class DoSomething { private int timesDone; ... } Which is the right way to named variable 'timesDone'? Sometimes I see named as m_timesDone. Is this correct? Where I can find information about naming guidelines? Thank you! ...

.NET: Can you manually specify which types to include in autogenerated WSDL?

Is it possible to make the auto-generated WSDL for a .NET web service include descriptions for certain data types if no web method returns that data type of takes that data type as a parameter? I could just include a dummy webmethod that never gets called, but I'm looking for a less hacky way. Thanks! Mike ...

C#/.NET Windows.Forms - what .NET functionality supports uploading and downloading multiple files at once?

For a Windows.Forms application (C#), I have 2 functionality needs: Upload multiple files at once (3 files, around 1mb each) Transfer multiple files from server to client when ready For #2, transfering from server to client, the solutions I am considering are: Send from client to server send a message to the client that the files a...

Mapping enum with fluent nhibernate

I am following the http://wiki.fluentnhibernate.org/Getting%5Fstarted tutorial to create my first NHibernate project with Fluent NHibernate I have 2 tables 1) Account with fields Id AccountHolderName AccountTypeId 2) AccountType with fields Id AccountTypeName Right now the account types can be Savings or Current So the table Acco...

C#.net decorator pattern converting/setting collection...

Have a question about how to better optimize or speed things up. Currently my code seems to be running a bit slow... I have the following classes public class DataFoo : IFoo { } public class Foo { internal IFoo UnderlyingDataObject{get;set;} public Foo(IFoo f) { UnderlyingDataObject = f; } } Now, in ma...

Hide app.config

Hi, I want to hide app.config. There are some things like webservice address that shouldn't be visible to user. Maybe it`s some way to put this config in resources? Thanks ...

SqlBulkCopy.BulkCopyTimeout property

Hello everyone, I am using VSTS 2008 + C# + .Net 3.5 + ADO.Net to develop a console application to do bulk insert copy. I want to use both bulk insert batch and bulk insert timeout property. For the BulkCopyTimeout property, I am confused and want to know whether it applies for the whole bulk or applies to only each batch of the bulk? ...

C# code for downloading item, that checks text/binary, and gzip/non-compressed???

Hi, QUESTION: Anyone have some code they could post that will download a file from a URL/Link that will automatically handle: (a) binary or text based (b) gzip encoded BACKGROUND: I've been starting to do this but hitting hurdles. Like I was using WebClient however it seems it can't handle the gzip bit (need to drop back to HTTPWebR...

Best protocol\technology for real-time server-less chat application

I need to embed chat functionality into .NET application (Windows client app). Requirements: Preferably server-less/zero-config architecture (p2p), but not required Based on open standards (XMPP alike) Implementation (library) for .NET (native C/C++ is OK too) exists What can you recommend? Currently I'm looking at XMPP/Jabber, do y...

Mono Winforms Problem

Hey , does anyone know why a winform application in windows, reaches via the ending program flow , to the point : this.close (of the main form) , closes the application normaly in windows , but in Mono the windows get stucked... ? ...

Getting the byte bits as string

hello, I want to the bits (0 or one) from a byte in a string but I don't know how? Thanks. ...

Using Data Adapter to save in Access db, c#

Hi All I have loaded three tables to my application. After the work is done, I want to save it all. Using 'for each' (is there a better way?), I recreated from my different class objects three data tables. Now I have the tables, I think I added them to new ds DataSet ds= new DataSet(); ds.Tables.Add(emp); ds.Tables.Add(managers); ds.Ta...

Free Codesmith alternatives?

Are there any free/open source alternatives to Codesmith that would be comparable in features and generate .NET code? ...

Can I use my RegularExpression attribute instead of the DataAnnotations one?

I'm trying to use a reusable regex class and use along with DataAnnotations in MVC. Something like: [RegularExpressionAttribute1(typeof(MyRegex))] This compiles but no error is thrown if the property doesn't match. It all works with the standard [RegularExpression(@"^\s*\d+(\.\d{1,2})?\s*$")] ...