Skip to content

Instantly share code, notes, and snippets.

@AFelipeTrujillo
Last active August 29, 2015 14:24
Show Gist options
  • Save AFelipeTrujillo/534d7052d50b1a38a6d7 to your computer and use it in GitHub Desktop.
Save AFelipeTrujillo/534d7052d50b1a38a6d7 to your computer and use it in GitHub Desktop.
CSharp For Beginner - Assignment Variables
using System;
namespace CSharpBeginner
{
public class VariablesClass
{
public VariablesClass ()
{
}
//this function recives two params, sum and return total
public float sum(float x, float y){
return x + y;
}
public float subtraction( float x, float y){
return x - y;
}
//this function return a string and concat the function param.
public string yourName(string name){
return "Your name is:" + name;
}
//this function uses an implicit varible and return a String
public string implicitMethod (int x, string y){
return x.ToString() + " - " + y;
}
//this function uses an explicit coversion
public int explicitSum(int x, string y){
//Parse convert a String to Integer
return x + int.Parse(y);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment