Does anyone have a good technique for generating a valid xx.config file after you have finished creating your
public class XXXConfigurationElement : ConfigurationElement
{
[ConfigurationProperty("blabhblahblah", IsRequired=true)]
public YYYConfigElement Foobar
{
get { return (YYYConfigElement )base["blabhblahblah"]...
Hi everyone,
I'm wondering what's good out there for AOP / crosscutting in .Net, along the lines of AspectJ. I see Microsoft has a policy injection application block; any other good stuff out there I should take a look at?
...
I'm working with an unmanaged library through P/Invoke and it uses three structs (although they all have the same basic layout, so I'll only post one):
struct Agraph_t {
int tag:4;
int kind:4;
int handle:24;
char **attr;
char *didset;
char *name;
Agdata_t *univ;
Dict_t *nodes, *inedges, *outedges;
Agr...
I have a Windows Service written in C# (.Net 3.5) and I need to store some state somewhere so that next time the service starts up, it knows where it left off.
What is the recommended store for this type of thing? The registry? What if I just put some user settings in a Settings.settings file? Where would the user profile be for a servi...
I'm porting over a Java project that I wrote which uses the Apache Commons StringEscapeUtils class (particularly the
escapeXml
unescapeXml
escapeHtml
unescapeHtml
methods). Is there a .Net equivalent? Or perhaps some totally logical bit of C# code that accomplishes the same thing?
...
how to implement event sink to enable the developed application to listen to event made by this three browsers: Internet explorer, mozilla firefox and google chrome?
the application is a stand-alone application running in a network..
thanks!^^
...
Let's say I have the following:
public void MakeMatrix(int matrixLength)
{
int[,] Matrix = new Matrix[matrixLength,matrixLength]
PopulateMatrix(Matrix);
PrintMatrix(Matrix);
}
In the PrintMatrix(int[,] Matrix) function, how to I find the length of only one dimension of the multi-dimension array?
public void PrintMatrix(in...
In my app I allow the user to build a color, and then show him the name or value of the color later on. If the user picks red (full red, not red-ish), I want to show him "red". If he picks some strange color, then the hex value would be just fine. Here's sample code that demonstrates the problem:
static string GetName(int r, int g, int ...
One of the great things about LINQ is that allows you to get information that's related to a collection without having to manually write code to iterate through the collection. Is there a way to use LINQ to populate a collection, thus avoiding the need to write a loop?
For example, let's say I have the following code which works with...
I need to know whether the Windows taskbar is hidden or not. I believe there is no .NET method to do this, and also I have come across a lot of "how to hide and show the taskbar" samples, but I haven't seen anything based on what I am looking for. I am not familiar with the Windows API, so I find it hard to understand traditional Windows...
Hello all,
I am making an application using c#.net. It contains a filesystem minifilter driver also. I want to install and uninstall this driver programmatically using c# .net. Normally i can install this using the .INF file (by right click + press install).but I want to install this programmatically. There is an SDK function InstallHin...
I am aware that System.Threading.Timer exists, but I already have a Thread. This thread is supposed to stay alive all the time, but only execute every X seconds. The test implementation looks like this:
public class MailClass
{
private Action<string> LoggerAction;
private bool _exit;
public MailClass(Action<string> loggerAc...
I use the function PointToScreen to get the screen related point of the control it gives proper value if I use this function for the toolstrip which is top on the form, but if there is menustrip on the top of the form and then under the menustrip, toolstrip is there then the function does not give proper value of screen point for the con...
I have a list box that when an item is selected or deselected I want to save the changes to an xml file (so it is always up-to-date on the file and the user does not need a "save" button).
While testing I occasionally am hitting this IOException:
The process cannot access the file 'C:\MyPath\MyFile.xml' because it is being used by anot...
(C#, VS2008) In a program I'm working on, I've got lots of objects that all have an ID and implement IComparable so that List<>-s of the various objects are easily searchable by ID. Since I hate copy/pasting code, I thought I'd abstract that bit of functionality down to a base class, like so:
using System;
namespace MyProg.Logic
{
...
I wrote simple code to open a Word file (.docx) and set properties for that file. This code do exactly itself job. But when C# opens Microsoft Word I should update all fields to see real values which are updated from my code!
I want to know, what I do in my code to when Microsoft Word is open, all properties have real values and no more...
I have a WindowsForm with a panel control which I use to display my UserControls. I add controls this way:
private void AddControl(Control control)
{
panel.Controls.Clear();
control.Size = new Size(panel.Width - 1, panel.Height - 1);
control.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles...
Let's say I create a class "Planet" that can be inherited. One of the purposes of inheriting is to create a template with different default property values. Eg:
Public Sub New
MyBase.New
MyBase.ForeColor = Red
MyBase.Name = "Mars"
etc.
End Sub
Now, to stop the defaults serializing in the InitializeComponent method, the...
Okay I need help, again! For some reason it is not working, no idea why.. nothing even appears on my catch request..
public void load(object sender, DoWorkEventArgs e)
{
int repeat = 1;
int proxyIndex = 1;
if (listBox1.Items.Count == proxyIndex) //If we're at the end of the proxy list
{
pr...
This is what my service contructor looks like:
public Service(string path)
and I'm configuring unity like this:
IUnityContainer container = new UnityContainer();
container.RegisterType<IService, Service>();
which of course is not correct. The path parameter needs to be specified, and I would like this to be configurable from the Ap...