- What are the Refactoring tools?
- How to transfer an image from one web service to another web service?
- Is there a partial method?
- How to port digital keys from one system to another?
- What are the patterns promote loose coupling?
- What are the differences between basichttpbinding and wshttpbinding?
- What are the differences between the list view in asp.net 2.0 and 3.5?
- What are the new features in .net 3.5?
- Why factory pattern is a hindrance to soa?
- What is a framework? What are the things to consider when a framework is developed?
- Can a temporary table have a primary key?
- Can a temporary table be indexed?
- When a table is created
Archive for the ‘C#’ Category
C# Questions
Friday, August 20th, 2010Publishing MVC 3 sites with Visual Studio 2010
Sunday, August 8th, 2010The other day I have got into problem with publishing an asp.net mvc3 site to a shared hosting provider. The server is Microsoft 2008, but it did not have Front Page installed – any version of Visual Studio 2010 needs to have the Front Page to do the publishing. Here is how to publish a site in a situation like this:
- Use the FTP option and create a blank asp.net application on the server. This does not require Frontpage.
- Now, turn to the project on the local box. Build the project locally on the box.
- Publish the site to a different directory locally.
- Copy the whole site – directories, files – to the server.
- Copy the System.web.mvc.dll to the bin folder. Please make sure the mvc dll is a mvc3 version.
Finding Fibonacci series
Wednesday, February 10th, 2010using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Fibonacci
{
class Program
{
static void Main(string[] args)
{
// Using simple for loop and variables...
int pp = 0;
int p = 1;
int c = 0;
Console.WriteLine("Using Simple Loop...");
for (int idx = 0; idx < 10; idx++)
{
Console.Write("{0} ", c);
pp = p;
p = c;
c = p + pp;
}
// Using recursion...
Console.WriteLine();
Console.WriteLine("Press a key...");
Console.ReadKey();
Console.WriteLine("Using Recursion...");
for (int idx = 0; idx < 10; idx++)
{
Console.Write("{0} ", GetFiboancii(idx));
}
Console.WriteLine();
Console.WriteLine("Press a key...");
Console.ReadKey();
// Using C# 3.0...
Console.WriteLine("Using C# 3.0...");
Func
fib = n => n > 1 ? fib(n - 1) + fib(n - 2) : n;
for (int idx = 0; idx < 10; idx++)
{
Console.Write("{0} ", fib(idx));
}
Console.WriteLine();
Console.WriteLine("Press a key to quit...");
Console.ReadKey();
}
static private int GetFiboancii(int x)
{
if (x <= 1)
{
return x;
}
return GetFiboancii(x - 2) + GetFiboancii(x - 1);
}
}
}
What makes a language Object Oriented?
Tuesday, January 26th, 2010There are three qualities that make a language Object Oriented.
- Inheritance
- Encapsulation
- Polymorphism
Inheritance: Inheritance is the behavior of one class can inherit behavior and properties from another class.
- Class inheritance
- Interface inheritance
Encapsulation: Encapsulation helps encapsulate data methods and properties.
- Data and method hiding through private access keywords.
- Class hiding in a class hierarchy. The client does not see some class in the class hierarchy.
Polymorphism: Polymorphism is poly + morphism which is multi behaviors.
- Overriding
- Overloading
- Delegates
Which is better – float or double or decimal?
Monday, January 25th, 2010The float and double data types are floating or approximations. The float has a precision upto 32 bits. The double has precision upto 64 bits. In financial calculations where the precision is very importa, decimal is appropriate. The decimal can give precision upto 128 bits.