Tuesday, June 26, 2012

Explicit Interface Implementation

Below is an example on how a class can implement multiple interfaces with the same method name. "Method1()" in the below example.  It can done using  explicit interface implementaion.


// Interface 1
interface Interface1// Interface 2

{
void Method1();
}

interface Interface2
{
void Method1();
}
 
// Class implements interfaces

class TestInterface : Interface1, Interface2
{
//Explicit Interface implementation
void Interface1.Method1()
{
Console.WriteLine(" Hello world from Interface 1");
}
void Interface2.Method1()
{
Console.WriteLine(" Hello world from Interface 2");
}
}
  
static void Main(string[] args)
{
Interface1 I1 = new TestInterface();
I1.Method1();
Interface2 I2 = new TestInterface();
I2.Method1();
}

Tuesday, August 16, 2011

How to say "No to all" for an overwrite option in xcopy DOS command

usually, when we want to copy files from source to destination and when the destination has got same files as that of source then the DOS command prompts the user with overwrite (Yes/no/all)options.

When we say "a" it overwrites all the files in the destination files if they are same files as that of source.

In order to save some time when you copy large amount of files. Here is the option...

Create a txt file(let's say n.txt) with a single line of all "n"(nnnnnnn) then run the batch files with the following content...

xcopy Test1 Test2 < n.txt

Another option would be to use Robocopy.exe. This would only copy the files which has got different size and timestamp.

robocopy test1 test2.


Tuesday, June 7, 2011

Update Service Reference for a Silverlight Application

Updating the service reference for a silverlight application sometimes throws an error

Custom tool error: Failed to generate code for the service reference...


and it also deletes the content in ServiceReference.ClientConfig file.


Solution steps.

1. Right click on the Referred WCF service under Service References
2. Select "Configure Service References..."
3. Uncheck "Reuse Types in referenced assemblies" checkbox
4. Restores the content in ServiceReference.ClientConfig

Tuesday, August 3, 2010

stsadm -o uninstall

Never ever use this command. Just wanted to share my experience.

stsadm -o uninstall doesnot take any parameter. If you type this command and press enter . It uninstalls the SharePoint from your machine without asking for any cofirmation.

Always use -help after each command to see the Parameter list.

stsadm -o uninstall -help.