Detect Debug Mode in Managed C++
What's the best way to detect whether an app is running in debug mode in Managed C++/C++/CLI? ...
What's the best way to detect whether an app is running in debug mode in Managed C++/C++/CLI? ...
I have 2 separate classes: AreaProperties FieldProperties 1 AreaProperties can map to 1 FieldProperties. Without changing the design, I want a method to return a List<> of these objects What generic collection in C# would be suitable? I understand I can send 2 Lists and the function would look like: public List<AreaProperties> Sa...
I would like the SO community let me know what does juniors and proficient .NET Developers should know regarding the following subjects, also some code examples or brainteasers like the ones here will help a lot. System Types Collection and Generics Configuration and Installation Monitoring and Debugging File I/O Globalization ...
Can anyone think of an efficient way (time wise) to trim a few selected characters from the middle of a string? Best I came up with was: public static string Trim(this string word, IEnumerable<char> selectedChars) { string result = word; foreach (char c in selectedChars) result = result.Replace(c.ToString(), ""); re...
I was reading about flag enums and bitwise operators, and came across this code: enum file{ read = 1, write = 2, readandwrite = read | write } I read somewhere about why there is a inclusive or statement and how there can't be an &, but can't find the article. Can someone please refresh my memory and explain the reasoning? Also, how ...
If you are planning to write a very parallel application in C#, is it better to build things very small, like 20 small classes, making 40 larger classes, and together making 60 more, for a total of 120 or gigantic like: making these 60 classes individually (still with reusability in mind). So in #2 these 60 classes can contain method...
Currently I'm using XmlSerializer to serialize and deserialize an object. The xml is generated in an undefined order which is understandable but makes it annoying when comparing versions of the object, since the order of properties is different each time. So for instance I can't use a normal diff tool to see any differences. Is there an...
I am trying to find a class or something that would allow me to do Shamir's Secret Sharing. I found a program in C# that allows you to do it but it does not supply source code. I was just wondering if anyone has a class that already does what I need. ...
I'm tired of dealing with config files so I'm trying to setup a WCF service in code only. So far I have this: m_ServiceHost = New ServiceHost(Me) m_ServiceHost.AddServiceEndpoint( GetType(Aam.AamServiceFramework.IServiceMonitor), New NetTcpBinding, "net.tcp://localhost:6000) m_ServiceHost.AddServiceEnd...
I'm working on someone else's project that makes heavy use of tableAdapters. The site works but It regular adds an entry in the Event log : "ExecuteReader requires an open and available Connection. The connection's current state is connecting. " The site doesn't throw an exception though unless there is high traffic (5+ request...
Does .NET (C#) have built in libraries for FTP? I don't need anything crazy... very simple. I need to: FTP into an account Detect if the connection was refused Obtain a text file Delete the text file What's the easiest way to do this? ...
I have a usercontrol I created. I added a panel and a vertical scrollbar to the right of it. I'd like to be able to scroll it with the mousewheel. The problem is there doesn't seem to be any events that fire on mousewheel. If I take the panel off then the usercontrol has focus and it will fire on mousewheel in the form. But with the...
So I'm receiving data over a socket using a buffer (byte[]) of size 1024, and I want to combine the reads together to form the entire packet in the event that they're bigger than 1024 bytes. I chose a List to store the entire packet, and what I want to do is add each buffer read to it as it comes in. I'd want to do: List.AddRange(Buffer...
I have a custom WCF ServiceHost that opens a persistent object to an external resource. The operations on the contract are then wired on to this persistent object. The persistent object manages itself to ensure it's always in a usable state. I'm having a difficult time deciding where it is safe to dispose this object -- because once it'...
I'm trying to unit test values that will eventually wind up in a web.config file. In my test project, I created an app.config file with a web.config section to hold the settings. In a normal situation, I would call System.Configuration.ConfigurationSettings.AppSettings, but in this case, that doesn't work. I saw this question, which is v...
A coworker used a for loop to iterate a List in some C# code he wrote and left the comment, "did't use For Each because I wasn't sure it iterates in order. Who knows what Microsoft will do." For example, suppose we have a List built up like this: var someList = new List<string>(); someList.Add("one"); someList.Add("two"); someList.Ad...
Frequently when I am using the Reflector, I come across lots of unsafe code. Anyone knows how much of .NET is unmanaged/safe? ...
We've got a .net 2.0 web system that dynamically builds pdf files. Some of these files can get pretty large - 12MB+. While processing time isn't a factor, really, the size of the files to be downloaded is in some cases. For the moment, let's assume that our B-grade pdf library is already making the smallest files that it knows how. ...
In my software I need to be able to interface to a very simple document management system. I need to be able to: Check in/out documents Add documents delete documents maybe version documents. (The domain expert says no, I suspect he is wrong.) At this time we have no need to search the documents. I need to be able to do this fro...
In C# 3.0 you can create anonymous class with the following syntax var o = new { Id = 1, Name = "Foo" }; Is there a way to add these anonymous class to a generic list? Example: var o = new { Id = 1, Name = "Foo" }; var o1 = new { Id = 2, Name = "Bar" }; List<var> list = new List<var>(); list.Add(o); list.Add(o1); Another Example...