c#


Where should I declare my delegate method? [on hold]


public delegate void CalcOperation(b.ItemName,b.Quantity,b.Price);
where should I declare this delegate?
public class Program
{
public static void Main(string[] args)
{
Billing b=new Billing();
Console.WriteLine("Enter item name");
b.ItemName=Console.ReadLine();
Console.WriteLine("Enter quantity and price of the item purchased");
b.Quantity=int.Parse(Console.ReadLine());
b.Price=Double.Parse(Console.ReadLine());
Console.WriteLine("Item Name:{0}",b.ItemName);
Console.WriteLine("Quantity:{0}",b.Quantity);
Console.WriteLine("Price:{0}",b.Price);
CalcOperation c1 = new CalcOperation(Calculate);
c1(b.Quantity,b.Price);
}
}
public class Billing
{
public string ItemName;
public int Quantity;
public double Price;
public static void Calculate(int Quantity,double Price)
{
Console.WriteLine("Total Amount:{0}",Quantity*Price);
}
}

Related Links

Set field via class
how to use ModelState.IsValid in ASP.NET?
protobuf-net : v2 deserialize v1 objects with inheritance
Getting data on ListView Select event and setting it in a div in C#
c# Oledb add list of parameters in a foreach loop
dotnet ef not works with ef tools 1.1.0-preview4-final
Check permission of a PDF using itext [duplicate]
Is there an event fired when WebBrowser content is redrawn?
How can I filter a DataTable without brute-forcing it?
Creating objects using an older version of Google Protobuf
WPF Combo box not calling setter method when item changed
Entity RemoveRange delete all rows
zip is not working in the same way on 4.2 to 6.0
Twilio Error - 12300 - Invalid Content Type only sometimes
Range validation in the Form Designer's PropertyGrid of a shadowed property
SaveChanges without AcceptChanges

Categories

HOME
http
postgresql-9.3
display
abc
c++builder
glsl
nagios
magento-1.9.2.1
mailchimp
checkpoint
docker-compose
servicenow
symfony-3.2
restheart
ephesoft
ios-universal-links
decoding
comma
bookmarklet
views
serenity-js
prepros
paper-trail-gem
arp
deferred
boost-log
jql
directions
epub
webmock
kepserverex
gem-fury
idea-plugin
amazon-rds-aurora
text-extraction
synchronized
jcs
beanshell
fluent-nhibernate-mapping
aot
liferay-ide
timex
scrollmagic
esprima
portaudio
universe
deck.js
csc
shtml
cexception
code-translation
video-embedding
dynamics-nav
controlpanel
commercetools
play-json
vanilla-forums
winforms-interop
euro
sicstus-prolog
service-broker
chrome-mobile
conkeror
esri-arc-engine
pysvn
jsonmodel
jsonschema2pojo
register-allocation
worklight-appcenter
ios-enterprise
im4java
scjp
xpand
nodeunit
kernel-density
starling-framework
android-jack-and-jill
complete
svg-android
jfilechooser
kendo-window
mandelbrot
netzke
isgl3d
session-hijacking
vectorwise
datarelation
nstoolbar
dojox.gfx
rpxnow

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App