.net

C# Retrieving correct DbConnection object by connection string

I have a connection string being passed to a function, and I need to create a DbConnection based object (i.e. SQLConnection, OracleConnection, OLEDbConnection etc) based on this string. Is there any inbuilt functionality to do this, or any 3rd party libraries to assist. We are not necessarily building this connection string, so we cann...

Largest Heap used in a managed environment? (.net/java)

What is the largest heap you have personally used in a managed environment such as Java or .NET? What were some of the performance issues you ran into, and did you end up getting a diminishing returns the larger the heap was? ...

How to inflate a file with zlib.NET?

I'm using the zlib.NET library to try and inflate files that are compressed by zlib (on a Linux box, perhaps). Here's what I'm doing: zlib.ZInputStream zinput = new zlib.ZInputStream(File.Open(path, FileMode.Open, FileAccess.Read)); while (stopByte != (data = zinput.ReadByte())) { // check data here } zinput.Close(); The data...

Equivalent of Class Loaders in .NET

Does anyone know if it possible to define the equivalent of a "java custom class loader" in .NET? To give a little background: I am in the process of developing a new programing language that targets the CLR, called "Liberty". One of the features of the language is its ability to define "type constructors", which are methods that are e...

WeakReference and event handling

Is it a good practice to implement event handling through WeakReference if that event is the only thing holding the reference and that we would need the object to be garbage collected? As an argument to this: Folks say that if you subscribe to something it’s your responsibility to unsubscribe and you should do it. ...

What open source .Net utility projects or code libraries do you use?

I use log4net in just about every code project. I was wondering what other generally useful code projects are available? ...

Winforms - MVP examples

Does anyone have a good example code or test project for explaining someone MVP pattern. There are a lot of explanation links but i want to have some good example code to show others without reinventing the wheel. ...

What is the best language construction in C#?

What is the best language construction you have worked with in C#. One of my favorites is Generics. ...

Implementing a window manager like VS does it

My boss thinks the VS 2008 IDE Window Manager(autohiding, docking of Solution Explorer, Properties, etc) is the best thing since sliced bread. I can't find a control that resembles that functionality in the Toolbox. Is there a control like that available that you know of? Or should I go ahead and implement it myself? Btw, we're using...

How do I add to a list with Linq to SQL?

I have a table in the database that I'm retrieving using LINQ to SQL, and as a part of my processing I want to add to this list, then update the database with the new items + any changes I've made. What I thought I could do was this: var list = (from item in db.Table select item).ToList(); [do processing where I modify ite...

.NET partial class' accessibility over multiple files

If I have the core of a class defined in one file as "public partial" and I wish to create additions to this in another file, what is the difference between defining "public partial" again in my second file or just defining "partial"? What happens if I define "private partial" in my second file? ...

.NET Fastest way to iterate through rows in a datatable?

Which is generally fastest when reading/comparing row info from a DataTable? 'assume dt as datatable' 'method 1' dim i as int32 for i = 0 to dt.rows.count - 1 .... next 'method 2' dim row as datarow for each row in dt.rows .... next And if there's a difference, in what circumstances does it pay to use one over the other? Th...

How to display a VRML model with .NET?

Hello everybody! I have a request to display VRML models within a .NET application. Does someone know an easy way, maybe with standard .NET components, to achieve this? What are the issues I maybe have to face when representing VRML within an application? Thank you very much! Michael ...

In managed C++, how do I declare and call a function with an 'out' parameter?

I have a function which parses one string into two strings. In C# I would declare it like this: void ParseQuery(string toParse, out string search, out string sort) { ... } and I'd call it like this: string searchOutput, sortOutput; ParseQuery(userInput, out searchOutput, out sortOutput); The current project has to be done in m...

What is the maximum length of a C#/CLI identifier?

Which other restrictions are there on names (beside the obvious uniqueness within a scope)? Where are those defined? ...

Anyone using Microsoft ASML language?

To me the concept of "Gurevich Abstract State Machine" (formerly known as "evolving algebras") seems very promising to provide a solid fundation to systems behaviours. It could be what relational algebra is for databases: the underlying theoretic fundation. The most complete implementation, to my knowledge, is the Microsoft ASML languag...

Lazy initialization causing System.ArgumentException in Silverlight 2.0 beta

Hello! I've got the following example running in a simple Silverlight page: public Page() { InitializeComponent(); InitializeOther(); } private DoubleCollection dashes; public DoubleCollection Dashes { get { //dashes = new DoubleCollection(); //works ok //dashes.Add(2.0); //dashes.Add(2.0); if (dashes == null...

Create COM component and ActiveX controls in .Net (C# and .Net framework 3.5)

Is is possible to create COM component and ActiveX controls in .Net (using c# language). I searched internet but i could`t get anything. Thanks, santhosh ...

Visual Studio References and versioning - how does it work?

Hi, We have several common libs. Ideally we want them all to use the latest version of a dll even if they have been compiled against an older different version (assume the latest version is backward compatible) e.g we have: Project dll Common controls dll Logging dll Database access dll Project and common controls reference v2 of data...

C# - indexOf the nth occurrence of a string?

Unless I am missing an obvious built in method what is the quickest way to get the nth occurrence of a string within a string. I could loop the indexof method with the start index being updated on each loop but it sounds wasteful to me. ...