fcl

Does FCL already have an exception meaning method execution fail ?

I have my own exception, which been throwing on execution fail of a method (p/invoke in my case). public PInvokeException(string methodName) : base(String.Format(CultureInfo.CurrentCulture, "An error occured while external method '{0}' call", methodName)) { } But I want to replace it with already existing. Is there in FCL something li...

How to force Webbrowser component to always open web page in the same window?

Hi, I need to use webbroser in my application as it keeps repetitive tasks from employees, but there is aproblem with javascript that opens a new window in IE after clicking on anchor. How do I tell webbrowser component to "open new window" where I want it to be opened? For example in the other webbrowser component? ...

Use of the Facade pattern in .NET FCL

Does anyone know if the Facade pattern is used anywhere in the .NET FCL? Thanks Clarry ...

What are your most useful, lesser-known classes from the .Net FCL/BCL (any version) ?

I don't know how many times I've come across old code I've written and been able to replace it with a FCL class and halved the amount i needed to write,..but it's a LOT! From simple things like StringBuilder and Path through to more advanced, less obviously useful types like TypeConverter and StackFrame. I'm always on the look out to w...

Why is the Process class in the Diagnostics namespace?

Why is the Process class part of the Diagnostics namespace? This is a part of design of the BCL that kept me wondering for some time now. I find it kind of counter-intuitive, I fail to see the connection between Process and for instance the Debug and Trace classes. ...

Is BigInteger immutable or not?

In .NET 4 beta 2, there is the new Numerics namespace with struct BigInteger. The documentation states that it is an immutable type, as I would have expected. But I'm a little confused by the post-increment operator (++). This defintely seems to mutate the value. The following while-loop works: static BigInteger Factorial(BigInteger ...

Should I put custom code inside Microsoft's BCL/FCL namespaces?

A .NET programmer is allowed to wrap code inside namespaces and also to use a namespace already defined, even those defined by Microsoft in the Framework or Base Class Library. For example if I were to use System.Windows.Forms to outline this idea: Reference in assembly System.Windows.Forms.dll // This is my own C# source code file. u...

Is there any class in the .NET Framework to represent a holding container for objects?

I am looking for a class that defines a holding structure for an object. The value for this object could be set at a later time than when this container is created. It is useful to pass such a structure in lambdas or in callback functions etc. Say: class HoldObject<T> { public T Value { get; set; } public bool IsValueSet(); public v...

Generic built-in EventArgs to hold only one property?

I have a number of EventArgs classes with only one field and an appropriate property to read it: public class SomeEventArgs : EventArgs { private readonly Foo f; public SomeEventArgs(Foo f) { this.f = f; } public Foo Foo { get { return this.f; } } } Is there any built-in, generic class t...

What is the difference in intent between the serializers in FCL?

This question does a good job of explaining the difference in functionality between the serializers. BinaryFormatter is fast, XmlSerializer is interoperable, etc. I know that. But what is the difference in intent? What use-case was each class designed for? In particular: Why did they decide to make XmlSerializer blind for private dat...