.net

Castle Windsor: Constructor resolution order

Hi guys Just wondering how Castle Windsor determines which constructor to resolve when there are multiple constructors present. Cheers Anthony ...

Reading a file in vb.net

how to read a text file character by character in VB.NET?? ...

WF -- how do I use a custom activity without creating it in a separate Workflow Activity Library?

I am trying to accomplish something that seems like it should be very simple. I have a State Machine Workflow Console Application with a workflow in it. I have created a custom activity for it. This activity will NEVER be used ANYWHERE ELSE. I just want to use this activity on my workflow, but: It does not appear in the toolbox. I cann...

Unable to add a DLL Reference to VS 2008

Hi, I wonder if someone can help me. I'm trying to add a reference to the LAME MP3 encoder in my VB.Net (3.5) App. The DLL I'm using (lame_enc.dll v3.98.2) was downloaded from here: http://rarewares.org/mp3-lame-bundle.php When I try to add the DLL reference to my project, I get an error: "A reference to C:\\Lame_Enc.dll could not be ...

What do you name your Entity Framework data model?

With your LINQ or Entity Framework data models... what do you use as a standard naming convention for your data models? Or do you even have a standard? Using Northwind as the example... NorthwindDB? NorthwindData? NWDB? ...

How do I Draw a Bitmap with 50% Opacity?

Hello, I have a .png file, with alpha channel, that I use as the BackgroundImage on a Panel control. Under certain circumstances the control is disabled. When it is disabled I want the background image to be 50% transparent so that the user gets some sort of visual indication as to the controls state. Does anyone know how I can make ...

Using the current HTTP request identity as the default credentials for SharpSVN

I’m trying to call RemoteCreateDirectories in SharpSVN through a web app and want the credentials to be that of the logged on user. Can this be done implicitly or is the username and password required as per the example below? using (var svnClient = new SvnClient()) { svnClient.Authentication.DefaultCredentials = new NetworkCredentia...

Not able to start the windows service from service controller

I want to start a windows service which I have created from another windows service. I am using the service Controller which is available. But when I try to start the service I get a message, "Cannot open MyTestService service on computer '.'" I am working on the windows xp operating system. I have given the Account for the service whic...

Visual studio debugger: Break on entering an external function?

Hi, With "Just My Code" turned off and a source location/server, it's easy to step into functions that are not in your code. Is there a way to set a breakpoint on one of these, though? Basically I want to say "when this function is called from anywhere, break and show me the source". I tried the "set function breakpoint" and entering th...

Compress image in .NET

How can i compress and image file(bmp,jpeg) in C#, I have to display some images as background on my controls, i m using following code to scale my image Bitmap orgBitmap = new Bitmap(_filePath); Bitmap regBitmap = new Bitmap(reqSize.Width, reqSize.Height); using (Graphics gr = Graphics.FromImage(reqBitmap)) { gr.SmoothingMode = S...

What kind of setup (IDE et al) do I need to run IronPython unit tests of C#.NET developed assemblies?

I'm attempting to learn IronPython, to broaden my .NET horizons. I want to be able to use Python to write the unit-tests for my next personal project. So being able to access C#.NET assemblies from my Python code is necessary. I also wanted an IDE with auto-complete and smart indenting. PyScripter seemed like a good option, but can I ru...

Lucene.net-2.3.2" memory leakages problem

Is "Lucene.net-2.3.2" memory leakages problem solved or not solved? please help me how to solve it. i am facing it.. Thanks in advance.... ...

Unity Container: use ContainerControlledLifetimeManager by default for "Resolve" method group

Hi! How to fill TODO to make this test pass? class MyClass { } [Test] public void Singleton_by_default_test() { var parentContainer = GetUnityContainer(); var container = parentContainer.GetChildContainer(); // TODO: Add magic here (but do NOT explicitly register MyClass in container!) Assert.AreSame(containe...

Was is the performance of the Last() extension method for List<T>?

I really like Last() and would use it all the time for List<T>s. But since it seems to be defined for IEnumerable<T>, I guess it enumerates the enumeration first - this should be O(n) as opposed to O(1) for directly indexing the last element of a List<T>. Are the standard (Linq) extension methods aware of this? The STL in C++ is aware...

Getting XML serialization to automagically ignore non-serializable properties

I'm using the .NET serialization classes to XML serialize and log argument values that get passed to certain functions in my application. To this end I need a means to XML serialize the property values of any classes that get passes, but ignoring any properties that cannot be XML serialized (e.g. any Image type properties). I could go t...

Linq and nullable varchar column

Hello, is there any posibillity to turn off Linq replacing empty strings with null on nullable varchar columns? I could set the column to NOT NULL, but the scheme is used by other application too, so I would like to avoid that. I've tried to set column not nullable in DBML, but then I get "System.Data.Linq.ChangeConflictException: Raw...

How to get constructor as MethodInfo using Reflection

The constructor looks like this: public NameAndValue(string name, string value) I need to get it as a MethodInfo using Reflection. It tried the following, but it does not find the constructor (GetMethod returns null). MethodInfo constructor = typeof(NameAndValue).GetMethod(".ctor", new[] { typeof(string), typeof(string) }); What a...

GetDesktopWindow alternative when running as service

Hi, I am trying to test my WinForm app as part of the build (which runs as a service). I am using GetDesktopWindow and EnumChildWindows to find the controls I am interested in. This works perfectly when I run it in interactive session from the console, debugger, etc. but fails to find any control when run as part of the build. What can I...

What does .NET give me, that Win32 does NOT?

What would the usage of .NET give me, that i don't have using Win32 - and sometimes maybe googling for some 50-100 Lines of code i can reuse? I am developing Win32 since it exists (> 15 years). Its straight forward and very robust, although sometimes it needs some more calls than you'd expect, and of course you need to keep track of han...

Disabling NICs or blocking all tcp connections

I was wondering if it's possible to use .NET to disable a certain network interface or, in alternative, to drop all the existing TCP connections (from the whole system) and then inhibit further creation. I'm asking this because I want to write a small C# utility that monitors the system and blocks networking (or at least TCP connections...