Okay, I have a an interface, lets call it
public interface bar {
string Foo;
}
also have a class that implements the interface
public fooBar : bar {
public string Foo {get; set;}
}
I then have a property hanging off another object that contains a list of interface "bar" that contain different implementations, like so,
pu...
MSDN provides a digit placeholder example:
1234.5678 ("#####") -> 1235
I found this confusing (I expected 1234 or something), so I wrote this snippet in C# to test it:
Console.WriteLine(String.Format("{0:#}", 1234.5678));
Console.WriteLine(String.Format("{0:#####}", 1234.5678));
Console.WriteLine(String.Format("{0:#}", "1234.5678"));
Co...
Does anyone have any good recommendations for code profiling? I would like to be able to view the system heap, memory usage, garbage collection statuses, etc...
...
In C# you can use the implicit keyword to define an implicit user-defined type conversion operator.
In VB.NET you can define a CType conversion operator that will explicitly convert a user-defined type into another type.
Is there a way to declare an implicit conversion operator in VB.NET?
I can't seem to find any information on this.....
I have a bunch of custom attributes in my .NET application and I would like to require the user fills out certain properties within the attribute at runtime. Is this possible?
Ideally I'd like Visual Studio to produce an error when they try to build which states that since they used a particular attribute they must complete X, Y, Z prop...
So here is my dilemma, I want to handle view events on my view model, trouble is, in order to add an event handler, my view has to have a code behind file and therefore a class attribute has to be set. I'm 99% sure this is a bad idea, and to be perfectly honest, i'm not even sure how to do it (other than the obvious x:Class="" part) Wh...
I need to intercept ToolStrip Button click and cancel (break executing ButtonClick event).
All need to do from ToolStrip class level.
I've tried:
ToolStrip.ItemClicked( object sender, ToolStripItemClickedEventArgs e )
But [e] argument has no cancel property (only reference to ClickedItem), so I tried:
if (condition)
e.C...
I am trying to write a test and need to create a Message object with the IsFault property set to true. However, this property only has a getter. Does anyone know the best way to create a message where this property would be set to true?
Thanks
...
Is there a succinct way (i.e. not a for loop) to create a string of a specified length? Doesn't matter what is in the string.
...
We need to implement a WCF service on a machine that can only run .Net 2.0.
The machine is a Windows XPe POS terminal, and we have not found a way to install .Net 3.0. We can't really format it with a new XPe image because there is a proprietary POS application and drivers installed.
Is there any way to do implement a WCF service on ....
I'm launching a Java process ("java.exe") from .Net. using Process.Start(). In addition to the Java process, another process called conhost.exe is launched somehow. I am redirecting the output from the Java process to the .Net process.
Why is conhost.exe even launched?
How do I track it from .Net? I want to track this specific instance...
I am writing an application that must generate a plain Text file with fixed sized columns.
my current code is:
Dim MyFilePath As String = Path & FILE_PREFIX & FileNr & ".TXT"
IO.File.Delete(MyFilePath)
Dim FileStr As New IO.StreamWriter(MyFilePath, False, <ENCODER HERE>)
Do While r.Read
FileStr.WriteLine(r("TXTLine"))
Loop
FileSt...
Should a logging framework be injected into classes that need them or should every class that needs it just know the framework and use it directly? I am using Log4Net and currently I am injecting a service that wraps that framework into the classes that need to be able to log, knowing logging is probably not going to change and that mos...
I have a simple .NET 3.5 app for changing some database fields using an ODBCDataSet. Now the Feature Creep is asking if I can hide or show tabs and other controls based on the user's database permissions.
Ideally, I would like to control the permissions only on the SQL Server using Windows user groups, and the app would not have any bui...
Hi,
I'm downloading a file from a server and opening it using Process.Start() and attaching a file watcher to the file to catch any changes and re-upload them to the server.
Is there anyway to determine when the file has closed using the FileWatcher or any other method? The problem being I can't decide how to stop watching the file an...
Is there a simple way to compare two XML structures to determine if they have the same structure and data?
I have a function that returns an XmlNode and I am trying to write unit tests for it. I store the correct XML result in a file. Durring the test I load the file into an XmlDocument, locate the proper XmlNode and compare against t...
Is there a defined behavior for how regular expressions should handle the capturing behavior of nested parentheses? More specifically, can you reasonably expect that different engines will capture the outer parentheses in the first position, and nested parentheses in subsequent positions?
Consider the following PHP code (using PCRE reg...
Hi,
I'm using the below code to listen for change events of a file i download off a server and open. however the change event only gets fired the first time the file is saved, then on subsequent saves the file watcher does not fire the change events?
Can anyone see whats going on?
private FileSystemWatcher StartWatchingFile()
{
fw = ...
I'm writing an application for a POS and using POS for .NET. I've found that when I call the WaitForDrawerClose method, while the application will sit and wait unresponsively until the drawer is closed (as desired), any clicks elsewhere seem to pile up in the queue and all fire once the drawer has been closed. How can I make my app stop ...
How do you move a file after generating it to another folder without having name collision problem?
for example, i generate a CSV file name foo_20090820.csv and if i run the program again later on 08/20/2009 then the file will be foo_20090820.csv since on my target folder there already an file generated before the second file. The progr...