C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » General »

Example of reference type in C#.Net


Posted Date: 10 Sep 2008    Resource Type: Code Snippets    Category: General
Author: BuntyMember Level: Diamond    
Rating: 1 out of 5Points: 10



This C#.NET example will show how to use reference types in C#.NET.

Class ReferenceDemo
{
public void swap(ref int a,ref int b)
{
int c;
c=a;
a=b;
b=c;
MessageBox.Show("A="+a.toString() + "B=" + b.toString());
}
}
private void button1_click(Object sender,EventArgs e)
{
ReferenceDemo obj=new ReferenceDemo();
int x,y;
x=10;
y=20;
obj.swap(ref x,ref y);
MessageBox.Show("X=" + x.toString() + "Y=" + y.toString());
}





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Reference Type in C#.Net  .  Example of reference type in C#.NET  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Setting Authentication Cookies
Previous Resource: YahooSearch Service
Return to Discussion Resource Index
Post New Resource
Category: General


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use