.net

How do I make a TabPage's title text bold?

Hello, I have some tabControl in C# Windows app. It has some tabPages. Does anyone kwows how to make the tabPage Text to become Bold..? ...

Which is best for perfomance?

Which of the following code snippets performs fastest? if(ClassTestBase is ClassTestChild1) or if(ClassTestBase.Type == EClassType.Child1) Update: Here is the full scenario: public enum EInheritanceTree { BaseClass, Child1, Child2, Child3 } public class MyBaseClass { public virtual EInheritanceTree MyClassTy...

What does .NET Memory "Gen X Heap Size" .NET performance counters measure exacly?

Is that "the sum of all objects allocated" or is it "amount of memory allocated from the operating system for storing objects". Or is it something else? I think it is memory allocated from the OS, but would like a confirmation. ...

Stack calling convention between .NET & C on WinCE 6.0

Hi there. I'm porting a DLL written in C from WinCE 5.0 to WinCE 6.0 on an ARM target. This DLL is called by a .NET software. On WinCE5.0, everything runs fine. On WinCE6, I have the following problem: on InitInstance() of my DLL, I can call anything without problem (for example MessageBox()) or uses recursivity. Passed that point, th...

Is there a function called anytime ANY page is loaded in your application?

I want to be able to run a script anytime ANY page is loaded in the application. Is there somewhere I can simply add this? Or do I have to add the code in every page load? ...

Saving a file in client machine by calling a web service - ASP.Net & C#.Net

I'm facing a great problem here and i need some clarifications Here is my explanation I've a machine Machine1 I've hosted a web service WS1 in Machine1 I've a client application in Machine2 I call the web service WS1 from machine2 and the web service a file in the path sent by the application Okie works great! Now, I host another...

Methods which wrap a single method.

I think I'm going mad, someone please reassure me. public class MyFile { public static byte[] ReadBinaryFile(string fileName) { return File.ReadAllBytes(fileName); } public static void WriteBinaryFile(string fileName, byte[] fileContents) { File.WriteAllBytes(fileName, fileContents); } } Peo...

Access a static property of a generic class?!

I use a Height for all the Foos members. Like this public class Foo<T> { public static int FoosHeight; } public partial class Form1 : Form { public Form1() { InitializeComponent(); Foo<???>.FoosHeight = 50; // DO I Set "object" here? } } The same situation is in VB.NET. ...

What happend to AssemblyDescription in Windows 7?

We were using the AssemblyDescription attribute to add notes to our assemblies (e.g. fix/branch info). The text was visible on XP in the file Properties/Comments. However in Windows 7 this field has been hidden. Is there a way to show this field in explorer or any other tool? Does MS explain anywhere why this field was removed and wha...

What if I suppress "override"?

I remarked the compiler generates a warning if I suppress the override/new (Overloads/Shadows) keyword. Normally, I set the necessary keyword. But what if i forget it? // >>>> Case A - not virtual property - class MyPoint : Point { int X { get; set; } // vs new int X { get; set; } } // >>>> Case B - virtual property - class Foo ...

Can you limit the processing resources that an application can use in .NET

I would like to write a .NET application that runs in the background (stays down in the taskbar) and does a long operation like copying folders of files from one location to another. I want to write it in such a way that other applications that are running don't slow down much. I don't care how long the background app takes. Is there a w...

Can method inlining optimization cause race conditions?

As seen in this question: http://stackoverflow.com/questions/231525/raising-c-events-with-an-extension-method-is-it-bad I'm thinking of using this extension method to safely raise an event: public static void SafeRaise(this EventHandler handler, object sender, EventArgs e) { if (handler != null) handler(sender, e); } But ...

Is it safe to access a reference type member variable in a finalizer?

In other words, class Foo { object obj; Foo() { obj = new object(); } ~Foo() { obj.ToString(); /* NullReferenceException? */ } } ...

Nothing, WithEvents Fields and Memory Leaks

Is it necessary to set to Nothing(in Dispose()) all WithEvents fields? Apparently Handles keyword adds handlers to such fields, but does not remove it until this field is not Nothing, and this can generate memory leaks?!. This should be specially actual on cases like class Foo { Private WithEvents _bar as Bar Public Sub New(B...

How to use a resolver for collections in AutoMapper?

I want to map some of my domain objects back to ORM (LLBLGen) entities, for this I'm using AutoMapper. The domain objects contain collections, and the AutoMapper documentation states that we don't have to worry about them, just about the types they contain. This isn't always the case... When trying to map to the collections I'm getting ...

.NET Custom Control Resources.resx

I have a C# custom control that loads images from Resources.resx. I was loading this resources into the Project's Resources and then accessing them like: ProjectNamespace.Properties.Resources.resourcename; This works for one project but now I want to use my control in multiple projects. What's the best way to handle this? Load th...

XML Safe URLEncoding?

How do I encode an URL that will be "xml-safe" where the ampersand(&) in the querystring will not corrupt the XML? For Instance: www.somedomain.com/SomePage.aspx?SomeParam=SomeValue&SomeParam2=SomeVal ...

Quantity of specific strings inside a string

Hi, I'm working in .net c# and I have a string text = "Whatever text FFF you can FFF imagine"; What i need is to get the quantity of times the "FFF" appears in the string text. How can i acomplished that? Thank you. ...

Acceptable to lock (AppDomain.CurrentDomain)?

I want to enumerate all loaded assemblies in an Asp.NET application, using AppDomain.CurrentDomain.GetAssemblies(). However, when checking the documentation for AppDomain, I find the following statement: Thread Safety Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not gu...

Is there a possibility to differ virtual printer from physical one?

Hi. I have a list of all printers available in WinXP. I need the code (ideally .NET) to filter out all the virtual printers from this list. Is it possible to do? I analyzed all the properties of Win32_Printer wmi class but can't see any suitable one. Please help. ...