.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

When to use Interface instead of class, in VS 2008

Posted By:      Posted Date: October 19, 2010    Points: 0   Category :ASP.Net
 

Hi,

Why do we use Interface instead of class in VS 2008?

What between about Interface and class in VS 2008,high performance?




View Complete Post


More Related Resource Links

VS 2008 IDE does not see the AsyncPostBackTrigger class

  

I am trying to work with the AJAX AsyncPostBackTrigger class in the System.Web.Extensions 3.5assembly. I am in VS 2008 and the project is targeted for .NET 3.5.

In the IDE, the source for Default.asp, I am getting a warning (wavy green line) for the <Triggers> tag and the <asp:AsyncPostBackTrigger> tag. The cue for the Triggers tag is "XHTML 1.0 Transitional - element triggers is not supported".

for the other tag it is saying it is not a known element. Intellisense doesn't even list the <asp:AsyncPostBackTrigger>

Anybody have any suggestions what I may be missing? The System.Web.Extensions v 3.5 is listed in the Web.Config file and is in the project references.

Thanks


LINQ to SQL compiler error CS1519: Invalid token 'void' in class, struct, or interface member decl

  
I get the following compiler errors when creating my first LINQ to SQL class (I just dragged a table "ProfileExtended" onto the designer and hit build):DataClasses.designer.cs(31,11): error CS1519: Invalid token 'void' in class, struct, or interface member declaration these are the offending lines of autogenerated code:#region Extensibility Method Definitions  partial void OnCreated();  partial void InsertProfileExtended(ProfileExtended instance);  partial void UpdateProfileExtended(ProfileExtended instance);  partial void DeleteProfileExtended(ProfileExtended instance);  #endregion

SSIS 2008 generates Class not registered

  
I am getting the following error in SQL Server 2008 R2 (build 10.50.1734) x86 platform BI Development Studio (BIDS) 9.0.30729.4462 with .NET Framework 3.5 SP1 in a Integration Services project Data Source View table when I attempt to Explore Data: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) This happens on a Windows 7 Professional workstation x86 platform, (but has not been observed on Windows XP). The error occurs on Data Source Views bound to a Data Source connected to a SQL Server 2005 SP3 (build 9.0.4053) and SQL Server 2008 R2 server (I'm sure it's not a server issue, but a workstation issue). I have successfully unregistered and re-registered DTS.DLL and DTSComm.DLL in the registry, with no resolution to the issue. Does anyone have any ideas? Thanks.Greg

Database diagram failur - Invalid class string SSMS 2008

  
Hi There -  Help needed In SSMS 2008 (not express) the Database Diagram  cast the exeption "Invalid Class String" (MS Visual Database Tools). Why is this happening. I have used the diagram designer before succesfully My OS W7 - SqlServer 2008 - every thing updated  - every service pack installed I have tryed reinstall seceral times - not positiv What is going on - It had been working (1 month ago) Please help Freddy

Error on VS 2008 Class Library project: are you missing an assembly reference?)

  
http://msdn.microsoft.com/en-us/library/bb153523(office.12).aspx Working with ASP.NET 2.0 Web Parts and Windows SharePoint Services 3.0 Based on the above MSDN Walkthrough, I created a Class Library VS 2008 project. When clicking the Build menu, 11 errors on System.Web.Security etc popped up.  What's wrong? *********************************************** using   System; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; Error 1 The type or namespace name 'Security' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) Error 2 The type or namespace name 'UI' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

when abstract class and when interface

  
hi...need a practical scenario where interface can be used and where abstract class and also the need for constructors and destructors practically?? theoritically i know the differences ..but during coming to the implementation how to decide??...like why do u declare a class as abstract... thanks in advance 

Can WCF inherit a standard class interface?????

  

I have a standard Object Interface (read: no data contract decorations)  that is inherited by a number of classes. I want to enable this inteface for a new WCF service.

For example:

public interface iVendor

{

SSRS 2008 Interface with cube data source

  

Hi All,

Need some brainstorming and your experience here. Here is a situation and would like to understand your thoughts on this.

1. We have developed some cubes using SSAS 2008 to analyse the data.

2. We had some reporting requirement in the past and we decided to use our cube as a data source for the reports and develop using SSRS 2008.

3. We have developed many reports using the SSRS.

4. Now when the reports are passed on to the end users, they are not liking the SSRS interface...like at present we cannot increase the size of the drop down box, sorting any many other things..

As you might already know the SSRS interface i

SSRS 2008 configuration Manager - "Invalid Class"

  
Reporting Services Configuration Manager is throwing an error when I try to "Find" the server. The manager starts up and takes me to the "Reporting Services Configuration Connection" window. I click on the "Find" button (leaving the default comptuer name as-is; the local machine)  and get the error message "Invalid Class" with the title "Reporting Services Configuration Manager".

I've been searching around the interner and only found one forum post with a similar problem to my own. It was on this forum and the advice seemed to be pointing towards a problem with WMI, but it seemed that the user never found a solution. I've downloaded and ran the WMI diagnostics program and the log does contain quite a few warnings, but I don't know how to go about solving most of them. I did run regsvr32 on some dll files though :)

I won't post any logs yet, as I have no idea where the problem may be based. Please advise and I will post the required information.


Interface object Versus Class Object

  

Asslam o Alaikum

namespace Interface
{
    interface IMyInterface
    {
        void Start();    
        void Stop();
    }

    class Program : IMyInterface
    {
        void IMyInterface.Start()
        {
            Console.WriteLine("\n Void Start Method Implement");
        }
        void IMyInterface.Stop()
        {
            Console.WriteLine("\n Void Stop Method Implement");
        }
        
        static void Main(string[] args)
        {
            IMyInterface iMyInterface = new Program();
            iMyInterface.Start();
            iMyInterface.Stop();
        }
    }
}


1. IMyInterface iMyInterface = new IMyInterface(); // if i create the object of interface i get Error
2. Program iMyInterface = new Program(); // if i create the object of program i can't get the property of Interfaces i.e. Start(); stop();
3. IMyInterface iMyInterface = new Program(); // This will work fine

i want know the difference about 3 points can any body claer it ..

Thanks


SSRS 2008 Web Service Datasource doesn't return embedded class

  

Hello,

I am building reports with SSRS 2008 using web services as datasource.

Let me explain my design:

I have 2 classes:

public class Employee

{ public string fname;

public string lnamel;

public Department dept;

}

public class Department

{public string name;

}

i have this function as a web method:

public Employee GetEmployee(string lastname)

{
      Employee emp = new Employee();
      // I query the DB and return the result in a datatable
     // I then bind the table fields to my Employee object
     return emp;

}

When I test the service, it return the employee's info and his/her dept info as well.

But when i test the dataset in the report, it only return the employee's info and not the department info.

Any suggestion?

Thanks a lot!!!



Regarding Creating Custom Field type Class Inheriting from IFieldEditor Interface and UserControl C

  

How to enable the hidden labels On Create Column Page after selecting our Custom Field type before just ckicking OK so that all those labels appear.


How to set view properties from another class/interface

  

There is a SearchPage which has a properties ErrorMessage, SuccessMessage etc. This is basically a MVP pattern so for each page(view) there is IView that contains definitions for all the properties

I am using decoratoe pattern to set these peoperties dependingon the message type. There is another Interface IBaseMessage which has a method DisplayMessage() and a class BaseMessage which implements the interface. This class has a definition of the view

Interface IbaseMessage

{

DisplayMessage()

}

baseMessage:IbaseMessage

{

public Iview _view{get; set;}

DisplayMessage()

{

_view.Warning ="<message>"

_view.error="<message>"

}

Here, I am not able to set the message to the view properties. I am getting the error as "Object reference not set to an instance of the object"

Somehow the access is not going till theview from the class BaseMessage. I may be missing something. Please help

Appreciate your help!

}


Is it a bug in Visual Studio 2008 in WPF Designer when binding to enum defined inside of class?

  

Hello,

 

I have following problem:

when defining an enumeration inside of class (either static class or not) I can bind to this enum, however the WPF Designer inside Visual Studio does not display designed GUI anymore and show an error Type "MyClass+MyEnum" was not found.

However I can compile and execute the code and in the combobox all enum- values are listed.

 

Code behind:

    public class MyClass
    {
        public enum MyEnum { enumValue01, enumValue02, enumValue03, enumValue04, enumValue05 }
    }

 

My xaml-code:

<Window x:Class="SampleBindingOfNestedEnumToComboBox.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"          
    xmlns:local="clr-namespace:SampleBindingOfNestedEnumToComboBox"
    Title="Window1" Height="300" Width="300">

    <Window.Resources>

force use of interface instead of directly instentiating implemented class

  
    interface ITest
    {
        int Add();
    }
    class Test:ITest
    {
        public int Add()
        {
            throw new NotImplementedException();
        }
    }

    public class Program
    {              

        static void Main(string[] args)
        {
            // OK
            ITest t = new Test();
            t.Add();
            // disallow below 
            Test t1 = new Test();
            t1.Add();
           // Since both works, how to stop others from directly instentiating implemented class
        }
    }


 


Is it a bug in Visual Studio 2008 in WPF Designer when binding to enum defined inside of class?

  

Hello,

 

I have following problem:

when defining an enumeration inside of class (either static class or not) I can bind to this enum, however the WPF Designer inside Visual Studio does not display designed GUI anymore and show an error Type "MyClass+MyEnum" was not found.

However I can compile and execute the code and in the combobox all enum- values are listed.

 

Code behind:

  public class MyClass
  {
    public enum MyEnum { enumValue01, enumValue02, enumValue03, enumValue04, enumValue05 }
  }

 

My xaml-code:

<Window x:Class="SampleBindingOfNestedEnumToComboBox.Window1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:sys="clr-namespace:System;assembly=mscorlib"     
  xmlns:local="clr-namespace:SampleBindingOfNestedEnumToComboBox"
  Title="Window1" Height="300" Width="300">

  <Window.Resources>
    <ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="odp">
      <ObjectDataProvider.MethodParameters>
        <x:Type TypeName="local:MyClass+MyEnum"/>
      <

Adding IServiceClient interface to generated proxy service client class

  
Hi,
would it be possible to add a service client interface to a generated service client class in a generated service proxy in order to achieve easier testability?
Here's an example of what I am asking the way I do it manually http://blog.vuscode.com/malovicn/archive/2009/11/01/design-for-testability-wcf-proxies.aspx

This would not break backward compatibility (safe to be added)

Is this question more for Connect? :)

Thanks,
Nikola
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend