Using C# .NET 3.5 and WCF, I'm trying to write out some of the WCF configuration in a client application (the name of the server the client is connecting to).
The obvious way is to use ConfigurationManager to load the configuration section and write out the data I need.
var serviceModelSection = ConfigurationManager.GetSection("sys...
I have recently had an issue accessing MAPI through the dot net framework (explained in this artical) that in turn has generated memory access violation errors.
To get around this I opted to use a third party component from code project with a visual C++ core however we still have the problems.
I have never used visual C++ myself howe...
Is there an equivalent for Interlocked.Exchange for boolean? i.e., an atomic exchange of values that returns the previous value and doesn't require locks?
...
I want to copy a file from A to B in C#. How do I do that?
...
I'm looking for freely available resources that will help me pick up C# language and some of the basic API (like Collections). I already know Java fairly well, so looking for resources that assume background in Java.
...
Thinking about getting into .net technology project management
I've had plenty of experience with PHP projects: I'm aware of most of the existing frameworks and libraries, and I've written specs and case studies based on this knowledge.
What should I know about .net?
Which top resources would you recommend me to know so I can rapidly l...
I've recently taken up learning some C# and wrote a Yahtzee clone. My next step (now that the game logic is in place and functioning correctly) is to integrate some method of keeping stats across all the games played.
My question is this, how should I go about storing this information? My first thought would be to use a database and I...
Is there an easy way in C# to create Ordinals for a number? For example:
1 returns 1st
2 returns 2nd
3 returns 3rd
...etc
Can this be done through String.Format() or are there any functions available to do this?
...
Regarding the same program as my question a few minutes ago... I added a setup project and built an MSI for the program (just to see if I could figure it out) and it works great except for one thing. When I tried to install it on my parent's laptop, their antivirus (the free Avast Home Edition) set off an alarm and accused my setup.exe ...
I thought .Net code gets compiled into MSIL, so I always wondered how do Yellow Screens produce the faulty code. If it's executing the compiled code, how is the compiler able to produce code from the source files in the error message?
Feel free to edit this question/title, I know it doesn't really make sense.
...
I have a large text template which needs tokenized sections replaced by other text. The tokens look something like this: ##USERNAME##. My first instinct is just to use String.Replace(), but is there a better, more efficient way or is Replace() already optimized for this?
...
What are they, what are they good for, and how to I create my own?
...
What are all the possible ways in which we can get memory leaks in .NET?
I know of two:
Not properly un-registering Event Handlers/Delegates.
Not disposing dynamic child controls in Windows Forms:
Example:
// Causes Leaks
Label label = new Label();
this.Controls.Add(label);
this.Controls.Remove(label);
// Correct Code
La...
I'd like to take some RTF input and clean it to remove all RTF formatting except \ul \b \i to paste it into Word with minor format information.
The command used to paste into Word will be something like:
oWord.ActiveDocument.ActiveWindow.Selection.PasteAndFormat(0) (with some RTF text already in the Clipboard)
{\rtf1\ansi\deff0{\fonttb...
I'm developing an Excel 2007 add-in using Visual Studio Tools for Office (2008). I have one sheet with several ListObjects on it, which are being bound to datatables on startup. When they are bound, they autosize correctly.
The problem comes when they are re-bound. I have a custom button on the ribbon bar which goes back out to the d...
Are there any automatic methods for trimming a path string in .NET?
For example:
C:\Documents and Settings\nick\My Documents\Tests\demo data\demo data.emx
becomes
C:\Documents...\demo data.emx
It would be particularly cool if this were built into the Label class, and I seem to recall it is--can't find it though!
...
For my senior thesis, I developed a program that would automatically detect and suggest fixes to SQL injection vulnerabilities using prepared statements. Specifically the mysqli extension for PHP. My question for the SO community is this: What would your preferred approach be to detect the SQL in PHP source code?
I used an enum contai...
I'm trying to bind a list of custom objects to a WPF Image like this:
<Image>
<Image.Source>
<BitmapImage UriSource="{Binding Path=ImagePath}" />
</Image.Source>
</Image>
But it doesn't work. This is the error I'm getting:
"Property 'UriSource' or property 'StreamSource' must be set."
What am I missing?
...
The following code should find the appropriate project tag and remove it from the XmlDocument, however when I test it, it says:
The node to be removed is not a child of this node.
Does anyone know the proper way to do this?
public void DeleteProject (string projectName)
{
string ccConfigPath = ConfigurationManager.AppSettings["Con...
I want to test the behavior of a certain piece of .NET code in partial trust environments. What's the fastest way to set this up? Feel free to assume that I (and other readers) are total CAS noobs.
@Nick: Thanks for the reply. Alas, the tool in question is explicitly for unmanaged code. I didn't say "managed" in my question, and sho...