![]() |
|
Spaces home UnDevPhotosProfileFriendsMore ![]() | ![]() |
UnDevUndo with more syntatic sugar.
|
||||||
|
July 03 Zip in a MS supported assemblyPablo has the goods: http://feeds.feedburner.com/~r/PabloGaliano/~3/326003685/ZipandunzippingwithVS.aspx June 03 Abstract Class vs an InterfaceI was doing my weekly purusing of my RSS feeds and wanted to answer a question in regards to LA.NET's recent post:
So why did the ASP.NET team pick an abstract class modeling of System.Web.Abstractions over doing interfaces?
The key is really understanding the purpose of a interface as opposed to a abstract class. An interface gives you all or nothing contract with zero functionality given for defining the interface. Anotherwards in order to implement this interface:
public interface IBase{ void Test(); void Test2();} You would have to give definitions for both Test1 and Test2 even if you choose not implement Test2 for example but just need to provide mock results for Test2.
While below is perfectly valid code even though we do not implement Test2 in our derived class:
namespace AbstractTest{ public abstract class BaseClass{ virtual public void Test(){
throw } virtual public void Test2(){
throw } } public class DerivedClass : BaseClass{ public override void Test(){ base.Test();} } } April 10 Getting the name of the current console app.When creating a command line tool it is useful to know the name of the application executable at runtime. Most for handling the /? switch. Here is how:
AppDomain .CurrentDomain.SetupInformation.ApplicationNameSo if I named my application ConsoleApplication115:) this would provide: ConsoleApplication115.exe If the user changes the name to something less reasonable like: foobarUtil.exe it would provide the new name. April 09 Slight changeGot over zealious with the explicit namespaces:
string System.Drawing.whiteHex = ColorTranslator.ToHtml(white);
should be:
string whiteHex = ColorTranslator.ToHtml(white); Converting Hex color to a .NET Color object with one line of codeRemember to include:
using System.Drawing; From Hex to System.Drawing.Color object: Color white = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");From a Color object to Hex:
string
This friends list is empty. |
||||||
|
|