I have the following method I came across in a code review. Inside the loop Resharper is telling me that if (narrativefound == false) is incorrect becuase narrativeFound is always true. I don't think this is the case, because in order to set narrativeFound to true it has to pass the conditional string compare first, so how can it always ...
I'm attempting to write find/replace code for Word documents using Word Automation through Interop.Word (11.0). My documents all have various fields (that don't show up in Document.Fields) that are surrounded with brackets, eg., <DATE> needs to be replaced with DateTime.Now.Format("MM/dd/yyyy"). The find/replace works fine. However, s...
I have a MainView that contains a navigation bar which selects one of many XAML pages to be displayed in the page view pane. The MainView contains a ScrollViewer around the pages. This allows the pages to be whatever size they need to be and the MainView's ScrollViewer scrolls them. This all works great.
On one of the pages, I need t...
What are your thoughts on Raven DB?
I see this below my title: The question you're asking appears subjective and is likely to be closed.
Please don't do that. I think the question is legit because:
Raven DB is brand-spanking-new.
RDBMS's are probably the de facto for data persistence for .net developers, which Raven DB is not.
Giv...
Is it good practice to have a Factory method to retrieve injected objects or is it OK to just use the factory method from the DI framework?
I'm using structure map, should I just use ObjectFactory.GetInstance();, or should I create factory class and inside this class call ObjectFactory.GetInstance();? because if I call ObjectFactory.Get...
I have a control that I purchased. When I tried to inherit from the control I get this message:
Warning: 'MyNamespace.MyFile': base type 'Mooseworks.UI.MwTextBox' is not CLS-compliant
Is there any way around this besides asking the vendor of my control to make their control CLS compliant?
...
[Please edit the title if you find its not good enough]
I have code which triggers XSL-transformation:
objMemoryStream = new MemoryStream();
xslTransform = new XslCompiledTransform();
xpathXmlOrig = new XPathDocument("E:\\xslt error\\Simulation_of_error\\input.xml");
xslSettings = new XsltSettings();
xslSettings.EnableScript = true;
...
Disclaimers:
I am not interested in doing this in any real production code.
I make no claim that there's a good reason why I'm interested in doing this.
I realize that if this is in any way possible, it must involve doing some highly inadvisable things.
That said... is this possible? I'm really just curious to know.
In other words, ...
I want to get a list of processes running on a remote machine, and most of the time System.Diagnostics.Process.GetProcess("RemoteMachineName") works fine. But there is one server that only returns "Idle" as its sole process.
The user I'm running the program under has full login rights on that remote machine, and I can even be connected ...
Is DataRow.NewRow() insufficient as the only row in a DataTable? I would expect this to work, but it doesn't. It's near the end of my Page_Load inside my If(!Postback) block. gridCPCP is GridView
DataTable dt = new DataTable();
dt.Columns.Add("ID", int.MinValue.GetType());
dt.Columns.Add("Code", string.Empty.GetType());
dt.Columns.Add("...
Sorry about the vague title!
I have an class with a number of member variables (system, zone, site, ...)
public sealed class Cello
{
public String Company;
public String Zone;
public String System;
public String Site;
public String Facility;
public String Process;
//...
}
I have an array of objects of this...
I'm having issues trying to deserializing my xml string that was from a dataset..
Here is the XML layout..
<DataSet>
<User>
<UserName>Test</UserName>
<Email>[email protected]</Email>
<Details>
<ID>1</ID>
<Name>TestDetails</Name>
<Value>1</Value>
</Details>
<Details>
<ID>2</ID>
<Name>Testi...
Our team is still in a love / hate relationship with it. I am hoping to put an end to the debate by having an internal vote on what rules should be excluded and which rules should be added.
Before doing so, I wanted to ask others SO users. To standardize (but not limit) the responses:
What is your current StyleCop version?
What .Net v...
What is simpliest C# function to parse Json String into object and display it (C# xaml WPF)? (for example object wit 2 arrays - arrA and arrB)
...
I have a vb.net application which does some processing. This processing can take a while. The application doesn't respond until the processing has ended and then it handle all events (such as click on buttons) that the user has done during the processing. I'd like to add a "Stop" button so that the user can stop the processing at some po...
This is a pretty basic question, and I imagine that it is, but I can't find any definitive answer. Is SynchronizationContext.Post() threadsafe?
I have a member variable which holds the main thread's context, and _context.Post() is being called from multiple threads. I imagine that Post() could be called simultaneously on the object. Sho...
Ok so I have this storedproc in my SQL 2008 database (works in 2005 too / used to) ...
CREATE PROCEDURE [dbo].[SetBinaryContent]
@Ref nvarchar(50),
@Content varbinary(MAX),
@ObjectID uniqueidentifier
AS
BEGIN
DELETE ObjectContent WHERE ObjectId = @ObjectID AND Ref = @Ref
IF DATALENGTH(@Content) > 5
BEGIN
...
Why is the parameter on UpdClient.Receive a ref parameter, instead of simply out?
According to the MSDN page, the parameter is filled with the address that the datagram was sent from. However it doesn't specify what kind of input it is used for, only output.
...
Can anyone recommend a .Net XML Serialization library (ideally open source).
I am looking for a robust XML serialization library that I can throw any object at, which will produce a human readable XML representation of the public properties for logging purposes.
I never need to be able to deserialize.
XmlSerializer's requirement of...
I am writing a windows forms application in C# and I create a RichTextBox (via code, not the designer). I am setting the AutoWordSelection property to false, but when I highlight stuff in the box, it still jumps to the boundaries of words, plus a space. Is this a flaw in .NET or am I doing it wrong?
...