.net

Linq where in between IENumerable and List<>

I have filled List<Object1> Object 1 contain 2 fields (int id & string name) Also i Have IEnumerable<Object2> Generated by linq2sql. With fields (id, name) i need to get items from List<Object1> which Id's are absent in IEnumerable<Object2>. by Key Field = id (like where in in sql..) i used code like IEnumerable Object2 List<Object1...

NDepend metrics on assemblies

Do you try to keep the Distance from main sequence low for every assembly? What about assemblies that contains only Business Objects definitions? Is it possible to keep them away from Zone of Pain? Types in such assemblies are usually used by other assemblies and are rather concrete. How to handle such situation? ...

.Net Load Reference at runtime

I have following requirement, I have C#/.Net console application, which refers to 'System.Data.Sqlite.dll' 'System.Data.Sqlite.dll' is not registerd in GAC (i don't want to) I don't want to keep it in the directory where the Executable(.exe) is kept. How can i keep the 'System.Data.Sqlite.dll' file at some other directory , and load it...

How to cast managed reference types to unmanaged void pointers and back correctly?

The following example doesn't work, obviously. My question is how to make it work. array<String^>^ MyRefClass::GetAvailableInputs() { List<String^>^ result = gcnew List<String^>(); DirectSoundCaptureEnumerate(&DSEnumCallback, &result); return result->ToArray(); } BOOL CALLBACK DSEnumCallback(LPGUID lpGuid, LPCWSTR lpcstrDescription,...

Newb needs to learn how to query .asmx web service

Hiya, I've been thrown a project which I have to say I've not got the faintest idea where to start so I'm hoping someone can give me some pointers here! I'm working with a SharePoint intranet, and I need to query a web service which has been set up. In the words of the guy who set it up: The result of that query will be a DataS...

What is the fastest way to find out if a string ends with another string?

What is the best rewrite of this method to speed it up? public static bool EndsWith(string line, string term) { bool rb = false; int lengthOfTerm = term.Length; string endOfString = StringHelpers.RightString(line, lengthOfTerm); if (StringHelpers.AreEqual(term, endOfString)) { return true; } else ...

WCF Service with webHttpBinding; 404 error

Hi, does a service, which is configured like in the box below, throwing a 404 when there is a mismatch in the parameter? In this case the parameter is a complex type and every call to the SearchJson method returns a 404... ( is it even allowed with the WebInvoke option and WITHOUT the UriTemplate? ) The service is up and running ( i ca...

How to extend NHibernate to support more databases?

If I needed to get NHibernate to support more databases (not included in the list of supported: https://www.hibernate.org/361.html), assuming that database can be accessed using it's built-in query language,but not SQL (example: http://kx.com/Products/kdb+.php)... How will I be able to get NHibernate to work with these databases? ...

Removing an inherited Attribute in .net

I got a ASP.NET MVC controller like this [Authorize] public class ObjectController : Controller { public ObjectController(IDataService dataService) { DataService = dataService; } public IDataService DataService { get;set;} } The Authorize attribute is defined as "Inherited=true" in the framework. So when i...

Generating PDF files from .NET by using standard .NET GDI printing classes

I'm looking for a way to generate PDF files using the standard PrintDocument and Graphics (GDI) classes in .NET. As far as I know, the only way to do that is by printing to a PDF printer. The problem is that a PDF printer driver always asks for a filename, but I need to control the filename from my code. Using a PDF library like PDFShar...

How do I use C# Generics for this implementation when the Generic Decision is based on a DB Value

We have a content delivery system that delivers many different content types to devices. All the content is stored in a database with a contentID & mediaTypeID. For this example lets assume the MediaType can be one of these 2 but in reality theres many more of them. Gif MP3 Because the content is stored in different places based on m...

Getting the relative uri from the absolute uri

I have a System.Uri, e.g., var uri = new Uri("http://www.domain.com/foo/bar"); How do I get only the relative Uri out of it: /foo/bar ...

Do ADO.Net DataTables have indexes?

Hello everyone, I am using VSTS 2008 + C# + .Net 3.5 + SQL Server 2008 + ADO.Net. If I load a table from a database by using a DataTable of ADO.Net, and in the database table, I defined a couple of indexes on the table. My question is, whether on the ADO.Net DataTable, there is related index (the same as the indexes I created on physica...

Allocating more than 1,000 MB of memory in 32-bit .NET process

I am wondering why I'm not able to allocate more that 1,000 MB of memory in my 32-bit .NET process. The following mini application throws an OutOfMemoryException after having allocated 1,000 MB. Why 1,000 MB, and not say 1.8 GB? Is there a process-wide setting I could change? static void Main(string[] args) { ArrayList list = new Ar...

Need Help Eliminating Weak References In My App

Hello. I am trying to resolve a memory leak(s) in my app. I've downloaded and ran RedGate's ANTS Memory Profiler 5.0 and the memory profiler tells me the leak has to do with WeakReferences. The problem I am running into is that I've never heard of a WeakReference nor are they explicitly declared in my app. From the reading I've done I b...

Passing an exception object to a webservice

Following on from a question here got me thinking.... Would it/is it possible that when an application encounters an unhandled exception for this exception object to be serialized and sent to a web service with a db backend. Then, using a utility or even within Visual Studio the exception object could be loaded from the db and inspected...

How do you group by multiple columns in LINQ TO SQL?

How do you group by multiple columns in LINQ TO SQL? db.Table.GroupBy(a => a.column1.ToString() + a.column2.ToString()) It seems ugly and with poor performance, and I don't even know if it works. Which is the right way to do it? ...

use Clickonce to dynamically load application manifests

I have an online-only clickonce application that optionally runs several difference modules. Currently all of those modules are deployed as part of a single application manifest. I would like to deploy the plug-in module dll each as a seperate application manifest. Then load each module only as needed from the main application. Is th...

Financial charts in .NET? Best library to display a live streaming 1-min stock chart?

We are using C# .NET. We're looking for a method to display live streaming 1-min financial stock charts. Need: - Candlesticks - Zoom/pan - The chart scrolling in real time as it receives streaming data Woud like: - A method to print metadata on the chart (buy/sell points, etc) We don't mind paying for it, so any recommendation goes! ...

How to programmatically tell if the terminal server service is running

How can I programmatically tell if the terminal services service is running and is healthy? I'm creating a .net console application that will check if terminal services are running on a list of computers. I can check the remote registry entry to see if it's enabled, but that doesn't mean it's running. I was thinking of making a socket c...