943,809 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 518
  • C# RSS
Nov 11th, 2008
0

helpplz

Expand Post »
when we go for webservices in .net webapplications? example plz?
2.what is mean by delegate and asynchronous delegate in .net
3.static method with example?plz
Reputation Points: 3
Solved Threads: 0
Junior Poster
sivak is offline Offline
132 posts
since Nov 2008
Nov 12th, 2008
0

Re: helpplz

I don't mean to give a useless answer but a simple Google search of all the above questions gives immediate and rich answers...
Reputation Points: 11
Solved Threads: 9
Junior Poster in Training
vckicks is offline Offline
58 posts
since Jun 2008
Nov 12th, 2008
0

Re: helpplz

that and you already asked this you act like a spammer

http://www.daniweb.com/forums/thread156668.html
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008
Nov 12th, 2008
0

Re: helpplz

when we go for webservices in .net webapplications? example plz?
2.what is mean by delegate and asynchronous delegate in .net
3.static method with example?plz

A web service is used like any other applications that provide services like dll for example it could hold a set of web methods those serves to make calculs or so. you can add them into your application you just go to the solution explorer right click on your project then click add web reference then follow the instructions to add your webservice
To instanciate it you just type it name it will appear in the intellisense for example if the web service is on the localhost server
LocalHost.ServiceName x = new LocalHost.ServiceName();

a delegate is a sort of method pointer, you can use it when you have more than one method but you want to chose when use each one

try this code for example

using System;

public delegate string DelegateDescription();

public class Person
{
private string name;
private int age;

public Person(string name, int age)
{
this.name = name;
this.age = age;
}

public string NameAndAge()
{
return(name + " is " + age + " years old");
}

}

public class Employee
{
private string name;
private int number;
public Employee(string name, int number)
{
this.name = name;
this.number = number;
}

public string MakeAndNumber()
{
return(name + " is " + number + " mph");
}
}

class MainClass
{
public static void Main()
{
Person myPerson = new Person("Price", 32);
DelegateDescription myDelegateDescription = new DelegateDescription(myPerson.NameAndAge);

string personDescription = myDelegateDescription();
Console.WriteLine("personDescription = " + personDescription);

Employee myEmployee = new Employee("M", 140);

myDelegateDescription = new DelegateDescription(myEmployee.MakeAndNumber);

string d = myDelegateDescription();
Console.WriteLine(d);
}
}


Asynchrone delegate are used when asunchrone calls are needed

Try this code

using System;


public class AsynchronousCallsASimpleExample
{
public static void Main()
{
AsyncCaller ac = new AsyncCaller();
ac.CallWriteLine("Hello");
}
}

public class AsyncCaller
{
// Declare a delegate that will match Console.WriteLine("string");
delegate void FuncToCall(string s);

public void CallWriteLine(string s)
{
// delegate points to function to call
// start the async call
// wait for completion
FuncToCall func = new FuncToCall(Console.WriteLine);
IAsyncResult iar = func.BeginInvoke(s, null, null);
func.EndInvoke(iar);
}
}
Reputation Points: 11
Solved Threads: 16
Junior Poster
Jugortha is offline Offline
172 posts
since Oct 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: hi uegent
Next Thread in C# Forum Timeline: Version of the Assembly





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC