.net

C# How to count managed threads in my AppDomain?

Is there a way to find out how many managed thread I use (including ThreadPool)? When I get count of unmanaged threads through GetProcess I have an insane number of it (21 at very beginning) ...

Why does not IDictionary (non-generic) inherit from IEnumerable<DictionaryEntry>?

IDictionary<TKey, TValue> inherits from IEnumerable<KeyValuePair<TKey, TValue>>, but IDictionary for some reason doesn't inherit from IEnumerable<DictionaryEntry>. I wonder why? I hate to write this ugly .OfType<DictionaryEntry>() every time when I need to make a query against an IDictionary. ...

How can i use listDictionary like list generic?

How can i use ListDictionary like List my sample codes below real codes is last one. for (int i = 0; i < listMyColumnNames.Count; ) { if (i < listMyColumnNames.Count - 1) ---> this is important Text += ", "; i++; } how can i do with ListDictionary. int Qu...

What kind of assemblies can be called using P/Invoke ?

Hi all, I allready asked at: Is it possible to call unmanaged code using C# reflection from managed code ? if it is possible to call C/C++ library unmanaged function with Invoke and reflection from .NET and the answer is yes. What I am not clear about is can I call using P/Invoke ANY assembly written/compiled/build with other compile...

How can i use listDictionary?

i can fill my listdictinary but, if running error returns to me in " foreach (string ky in ld.Keys)"(invalid operation Exception was unhandled) Error Detail : After creating a pointer to the list of sample collection has been changed. C# ListDictionary ld = new ListDictionary(); foreach (DataColumn dc in dTable.Co...

Difference between multiple inheritance and interfaces in c#

Does c# really support multiple inheritance. People say it supports multiple inheritance in the form of interfaces ? But I dont think so ...

Force ClickOnce - application to be started offline?

I have a click once application here that needs to be started offline exclusively sometimes. Reason is that it needs to be started VERY early during boot, at a point when there is no network connection yet, also it must not wait for any network connectivity. I know, this requirement seems strange, but it has legacy reasons. What do yo...

How can i solve "An explicit value for the identity column in table"?

if i try to add some data into my table error occurs: Error:Msg 8101, Level 16, State 1, Line 1 An explicit value for the identity column in table 'ENG_PREP' can only be specified when a column list is used and IDENTITY_INSERT is ON. insert into ENG_PREP VALUES('572012-01-1,572012-01-2,572012-01-3,572013-01-1,572013-01-2', '', '500', ...

Best way to convert Stream (of unknown length) to byte array, in .NET?

Hello, I have the following code to read data from a Stream (in this case, from a named pipe) and into a byte array: // NPSS is an instance of NamedPipeServerStream int BytesRead; byte[] StreamBuffer = new byte[BUFFER_SIZE]; // size defined elsewhere (less than total possible message size, though) MemoryStream MessageStream = new Memor...

IDynamicObject could not be found?!

When trying to run the sample code here: http://www.nikhilk.net/Live-Search-REST-API.aspx I get: Error 52 The type or namespace name 'IDynamicObject' could not be found (are you missing a using directive or an assembly reference?) E:\repo\NikhilK-dynamicrest-a93707a\NikhilK-dynamicrest-a93707a\Core\DynamicObject.cs 19 43 Dyn...

Downloading files. Network problems causes corrupt files.

My application downloads huge files using HttpWebRequest -> WebResponse -> Stream -> FileStream. See code below. With following the scenario we always get corrupted files: Start download. Unplug cable or click to pause download process. Close and open the application. Start download (it starts from the interruption point). Wait full f...

Serialize PrinterSettings gives exception

I am trying to persist the PrinterSettings (VB.NET 3.5), but keep getting exceptions reading back in. Here is the code I am using. Works fine on other types of objects. I have tried changing the default printer to a different printer, also used Microsoft XPS Document Writer. I read that .NET 1.1 had a problem serializing printersetti...

Do the assemblies in Add Reference dialog differ depending on .Net framework used?

I'm curious - does the listing of assemblies in the Add Reference dialog vary depending on the version of the .Net framework used for the selected project. If they do differ, I'd love to know where the differences lie. Thanks! ...

XmlReader skips half data sent to webservice

I have a web service that has one method: [WebMethod] public bool SyncUserData(string userxml) The xml is a series of user records and I use an XmlReader to read through the data and process it. When I call the web service with 2000 records, it processes 2000 records. When my client calls it with the same xml, it processes 1000 recor...

How can I solve out of memory exception in generic list generic ?

How can i solve out of memory exception in list generic if adding new value foreach(DataColumn dc in dTable.Columns) foreach (DataRow dr in dTable.Rows) myScriptCellsCount.MyCellsCharactersCount.Add(dr[dc].ToString().Length); MyBase Class: public class MyExcelSheetsCells { public ...

Fluent mapping help

Hi, This is probably a very simple question but I'm new to nHibernate and I'm having trouble working this out. I have a Page object, which can have many Region objects. I also have a Workflow object. Page and Region objects both have a relationship to Workflow and it's this double association that I'm having trouble with. The PageMap...

load a word document inside window browser

Hi, I have a page that dynamically links to a document that opens in a new page (the document is stored in a database as binary data and I loaded using the following code: Response.ClearContent() Response.ContentType = myReader("MIMEType").ToString() Response.AddHeader("Content-Disposition", "inline; filename=" & myReader("Filename"))...

Will PHP script running on top of Apache be faster than C# stand alone program doing same thing (same counting algorithm)?

I mean PHP scripts on Apache are oriented for many users to use tham at the same time. So will 1000 requests which came at the (relatively) same time be fully processed faster than C# .Net program performing algorithm 1000 times in while loop? So we input same data, we perform same algorithm, which is written in the very same way (resp...

how can i sort array via linq?

if i trying to sort my columns return 0 valu. But i need max value descinding value but how? for (int j = 0; j < dTable.Columns.Count; j++) for (int i = 0; i < dTable.Rows.Count; i++) { mycounter[i] = dTable.Rows[i][j].ToString().Length; } mycounter = mycou...

Multi-level inheritance with Implements on properties in VB.NET vs C#

Let's say I have 2 interfaces defined like so: public interface ISkuItem { public string SKU { get; set; } } public interface ICartItem : ISkuItem { public int Quantity { get; set; } public bool IsDiscountable { get; set; } } When I go to implement the interface in C#, VS produces the following templated code: public cl...