What are different ways to pass variables in a c# program?

What are different ways to pass variables in a c# program?
I was wondering if :
var numbers = textBox1.Text.Split('
.Select(int.Parse).ToArray();
var min = numbers.Min();
var max = numbers.Max();
textBox2.Text = string.Format("min:
{0} max: {1}", min, max);
and
private
int[] numbers =
new
int[10];
 were considered passing variables and I am also interested in learning new ways.

Hi Billst3r,
Your examples would be considered creating variables or "instantiating" them, which basically means creating them in memory.  To pass variables, here is a brief example.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
class Program
static void Main(string[] args)
// Declaring variables
int num1 = 1;
int num2 = 5;
// Pass created variables to private method
int answer1 = ComputeSum(num1, num2);
// Print results
Console.WriteLine(answer1);
Console.ReadLine();
private static int ComputeSum(int param1, int param2)
// Return sum of 2 provided parameters
return (param1 + param2);
Best of luck.

Similar Messages

  • What are different ways to load a class

    what are different ways to load a class??

    manoj.java wrote:
    I am preparing for something and exploring the java.
    want to know in regard of the same.
    Please help me out.And this means essentially nothing.
    Essentially there is only one way. Through a ClassLoader, and it's loadClass method. Now, there are multiple ways of invoking this, however, either directly or indirectly.
    Edit: There is, of course, other things, such as defineClass in ClassLoader, that lets you manually read a class defintion from somewhere, anywhere, and define, which, logically, also "loads" it.
    Now, once again, What are you trying to do? "something" and "exploring the java" are meaningless in this form. If you tell us what, exactly you are trying to do, we could actually help you do it!

  • What are different ways to share iPhone videos?

    I used my iPhone 5 to take several videos of my grandkids.  The videos range from 30 seconds to about 3 minutes.  I have put the videos onto my iMac in iPhoto, and still have them on my phone, as well.  I would like to share the videos with other family members.  What are my best options for doing that.  I tried email and sharing from iPhoto, but it says that only works for photos.
    Thanks.

    The fastest way is to upload them straight to FaceBook or YouTube, both of which you can do straight from your phone.  FaceBook will reduce the resolution, YouTube can keep it high.  Vimeo is another option, but I have no personal experience with it.
    All of these allow you to set permissions so that only those you want can see it.

  • What are different possible ways to start a process?

    Wondering what are different possible ways in which I can trigger a process in Aqualogic BPM.
    I have worked on WLI & there with the use of channels & event generators I could able to trigger my process for almost any event, be it file system update, Http Request or Database update.
    Can I trigger a process in Aqualogic BPM on arrival of a new file in file system (directory)?
    Any pointer towards documentation would also help.

    Hi,
    There are a lot of ways to trigger the process. You can execute any code based on a timming event, or external events such as JMS queues. Polling directories/webservers etc. is really easy.
    I'd suggest you take a look at the Studio documentation and read about Global Automatic activities.
    Hope this helps!
    Fernando

  • What are the objects that support variables?

    What are the objects that support variables?

    Using Variables: The Variable Wizard and the Variable Editor
    Definition
    Variables are parameters of a query that you defined in the Query Designer and that are filled with values when you execute the query or Web application. They serve as a store for characteristic values, hierarchies, hierarchy nodes, texts and formula elements, and can be processed in different ways.
    The processing type determines how a variable is filled with a value for the runtime of the query or Web application.
    There are different types of variables depending on the object for which you want to define variables. These types specify where you can use the variables.
    Variables are reusable objects. This means that when you define a variable for a query in the Query Designer, this variable can be used in all other queries. Variables are not dependent on the InfoProvider, only on the InfoObject. A variable that you define for an InfoObject is available in all InfoProviders that use this InfoObject.
    Use
    Variables enable you to customize queries flexibly (parameterize the query) possible. If you use variables in the Query Designer, do not select any fixed characteristic values, hierarchies, hierarchy nodes, texts, or formula elements. Instead, set up variables as place holders. These are then filled with values when the query is running (when you insert the query into a workbook, when you refresh the workbook or when you execute the query on the Web. You can use one query definition as the foundation for many different queries if you use variables.
    You want to create one query for all the people responsible for customer groups, who each only evaluate the data for one customer group. In the Query Designer, you insert a variable for the characteristic u2018customer groupu2019. Just before the query is executed, decide for which customer group(s) you want the query to apply to.
    There are two tools in the Query Designer for designing and changing variables.
    The variable wizard takes you step-by-step through the process of defining a variable. Each individual step is context-sensitive and is adjusted according to the combination of variable and processing types used. This means that the variable wizard only offers the selection options that are permitted for that combination of variable and processing types. For more information, see Defining Variables with the Variable Wizard.
    The variable editor dialog box offers all of the selection options for changing an existing variable. The individual fields in the dialog box show the settings affected in the variable. You can change these settings here. If you want to make the changes using a step-by-step process with explanatory texts, you can jump to the variable wizard using . For more information, see Changing Variables in the Variable Editor.
    Integration
    The variable wizard and the variable editor are functions in the Query Designer and are context-sensitive.
    In principle, the two dialog boxes appear wherever you can enter constants (that is, values) in input fields. One of these input fields is the Entry of Variables checkbox.  If you select this option, the following options for using a variable appear, instead of a fixed value:
    ·        The variables that are available appear in the dropdown box for the input field. You can select a variable from the dropdown box.
    ·        The symbol  Change Variable appears next to the Entry of Variables checkbox. You can change the variable using  . The Variable Editor dialog box appears.
    ·        The symbol  New Variable appears next to the Entry of Variables checkbox. Choose  if you want to create a new variable. The Variable Wizard dialog box appears.
    By way of an example, when defining conditions for the value limit of the condition, you can not only enter fixed values but also formula variables. Mark the Entry of Variables checkbox and you can then use the options described above. The settings are context-sensitive so that the formula variables that only those formula variables that are available appear in the dropdown box.  The variable wizard is set up automatically in the same way for entering formula variables.
    You can also get to the variable wizard and the variable editor from the context menu of those objects for whose values you can define variable placeholders. From the context menu, choose New Variable. The SAP BW Variables Wizard appears. In the context menu for variables that have already been defined, you can choose Edit. The SAP BW Variables Editor appears.
    In the InfoProvider objects dialog box, you select a characteristic (for example, Order) and from the context menu, choose New Variable. You reach the variable wizard, which is already set up for you to enter a characteristic value variable.
    In the InfoProvider objects dialog box, you select a characteristic value variable and from the context menu, choose Edit. You reach the variable editor where you see all of the settings for the variable. You can make changes to the variables here.
    Variable Types
    Definition
    The type of variable being used. This determines the object that the variable represents as a placeholder for a concrete value.
    Structure
    There are different types of variables depending on the object for which you want to define variables. These types specify where you can use the variables.
    ·        Characteristic Value Variables
    Characteristic value variables represent characteristic values and can be used wherever characteristic values are used.
    If you restrict characteristics to specific characteristic values, you can also use characteristic value variables. See, Restricting Characteristics.
    ·        Hierarchy Variables
    Hierarchy variables represent hierarchies and can be used wherever hierarchies can be selected.
    If you restrict characteristics to specific hierarchies or select presentation hierarchies, you can also use hierarchy variables. See Selecting Hierarchies
    ·        Hierarchy Node Variables
    Hierarchy node variables represent a node in a hierarchy and can be used wherever hierarchy nodes are used.
    If you restrict characteristics to specific hierarchy nodes, you can also use hierarchy node variables. See Restricting Characteristics: Hierarchies
    ·        Text Variables
    Text variables represent a text and can be used in descriptions of queries, calculated key figures and structural components.
    You can use text variables in the description of calculated key figures, restricted key figures, selections and formulas when you create them. See Defining Calculated Key Figures, Defining Restricted Key Figures, Defining Selections, and Defining Formulas.
    You can change the descriptions in the properties dialog box. See Query Properties Calculated Key Figure Properties Restricted Key Figure Properties, and Selection/Formula Properties.
    ·        Formula Variables
    Formula variables represent numerical values and can be used in formulas. See Defining Formulas.
    In addition, numerical values are used for selecting exceptions and conditions and you can also use formula variables here. See Defining Exceptions and Defining Conditions
    You can use a formula variable for the interest rate in order to process the current interest rate, after you have executed the query or Web application.
    http://help.sap.com/saphelpnw04/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm_

  • What are the ways to download j2ME app to j2ME phones

    Hello Friends,
    What are the ways to download j2ME app to j2ME phones, is there any method that all phones supports.
    I am downloading app to different phone in different ways, i.e using infrared, bluethooth, cable (different cable for different phones), URL (WAP)... offff.....
    Can any one let me know is there any one way that we can download app to phone... i mean is WAP URL support on all phone?
    Thanks
    Kumar.M.R

    The following Java tip may help:
    How to install a J2ME aplication on a mobile device
    http://www.java-tips.org/content/view/617/73/

  • What are various ways

    If its a off-topic please execuse me. But i am curious to know them. As there are so many experts here who have almost worked or have knowledge about different tools or software applications which do different tasks.
    As i am one of mumbaikar(mumbai normal person, India) and eyewitness for yesterdays serial bomb blasts and want to know whether internet can also be misused for communication.
    What are various ways to misuse internet for secret communication by terrorists or anyone who always think to do harm to human community.(by all means in terms of using software for all their communication)

    One could use forums to find out how to abuse the
    internet and then put what one learned into play.
    Why all these steganography-as-terrorism questions
    the last couple days? Homework assignment, or new
    approach for al qaeda?Sir jverd,
    I respect you as you being seniors here. But as i
    told you i am one of the co-passenger in the bomb
    blast but i have luckily escaped. I am just a newbie.
    I will feel to do something good for my nation. But
    just lack of experience and lack of information i am
    just curious of any concepts or links or information
    that will lead me to atleast 1% to do something good
    for my nation. But rather if i can say atleast i can
    save atleast one life if i can gather good
    information and go on to try myself and findout
    various ways to atlest have good knowledge and spread
    awareness. I dont feel this is something wrong.
    One could use forums to find out how to abuse the
    internet and then put what one learned into play.
    Why all these steganography-as-terrorism questions
    the last couple days? Homework assignment, or new
    approach for al qaeda?Sir jverd,
    I respect you as you being seniors here. But as i
    told you i am one of the co-passenger in the bomb
    blast but i have luckily escaped. I am just a newbie.
    I will feel to do something good for my nation. But
    just lack of experience and lack of information i am
    just curious of any concepts or links or information
    that will lead me to atleast 1% to do something good
    for my nation. But rather if i can say atleast i can
    save atleast one life if i can gather good
    information and go on to try myself and findout
    various ways to atlest have good knowledge and spread
    awareness. I dont feel this is something wrong.I didn't say it's something wrong. I'm just remarking on the rather coincidental appearance of multiple questions here in the last couple of days that ask about both terrorism and steganography.
    I have no idea who you are. You might be a survivor, or you might be one of people responsible for the bombing. I have no way of knowing, and am not making any judgements on you.

  • My iPhone 4S will not connect to the internet properly. It says that it is connected, the App Store won't load apps and I can't get on my face book app. I have tried wifi and my cellular data, neither work. What are some ways to fix this?

    My iPhone will
    not connect to the internet properly. It says that it is connected, the App Store won't load apps and I can't get on my face book app. I have tried wifi and my cellular data, neither work. What are some ways to fix this?

    Try resetting your network settings.
    Settings>Genenal>Reset>Reset Network Settings.

  • What are the ways in data transfer

    Hi Experts,
    What are the ways to transfer data from SAP R/3 to SAP BW and SAP BW to SAP APO DP?
    Can anyone help me please.
    Regards
    Suvi

    Hello,
    I can only help on part of your questions, since I'm not familar with R/3 data uploading ...
    If you want to download data from BW infocube to APO DP:
    1)For CVCs, you can just use /sapapo/mc62, input POS name, click 'Create Characteristic Combinations'.
       Then select an option except 'Create manually'.
       In the 'Data Source' area, select load data from 'InfoProvider'.
       Then you can load CVCs from infocube to APO system for generation.
    2)For transactional data (key figure values), you can use /sapapo/tscube.
       Just fill in the source cube's name, version, and tagert planning area's name, version.
       Key figure assignment and characteristic assignment are also necessary.
       Specify other options as to your requirement, and you can download transactional data from BW to DP.
    Best Regards,
    Ada

  • What are the ways to download data from ods?

    Hi all,
    what are the ways to download data from ods?
      1. se11/se12
      2. listcube
      3. infospokes.
    Apart from the above 3 is there any other way to download data from my ods.
    I need to download around 90 fields from my ods to a flat file. But listcube doesnt allow me to select all the fields. So i used se11 to download the data from my ods. bUt still se12 doesnt allow me to download all the 90 fields it downloads only 40 fields.
    Can anyone suggest me how to select all the 90 fields and download it to an excel sheet.
    thanxs
    haritha

    Hi Haritha,
    Go to Tcode SE16, give your ODS active Table name and give width of output list as 1023.
    Now run transaction to see your data and then click Settings --> User parameters and Select ALV Grid Display.
    Now you should see and Excel Icon on top, click on it then select Table , then
    Microsoft Excel and it will open your data with all columns you want.
    I just tried for 213 columns
    Hope this helps.
    Thanks
    CK

  • What are the ways to control CPU usage?

    Database: Generic
    OS : Linux
    Problem Description :
    Q: What are the ways to control CPU usage precisely like instance caging for 11g if the database host has multiple 10g instances?
    What are the ways to control CPU usage precisely in database host that has multiple 10g instances. I fear that particular instances
    overallocate CPU resource on the host and this affects performance of other instances on the host if CPU_COUNT value is set to default for every instances.
    ** Oracle is working on this issue, but in parallel is opening the topic to the Community so that Community members can add their perspective, experience or knowledge. This will further enhance all knowledge bases including My Oracle Support and My Oracle Support Communities; assisting all Community members and enabling richer solution searches. **

    ram_orcl wrote:
    Database: Generic
    OS : Linux
    Problem Description :
    Q: What are the ways to control CPU usage precisely like instance caging for 11g if the database host has multiple 10g instances?So in other words... how to reduce performance of a process by decreasing the CPU availability to that process. And what do you do with that spare CPU cycles? Imagine that things are now better as the CPU utilisation has dropped by 10% or so?
    What are the ways to control CPU usage precisely in database host that has multiple 10g instances. That is the kernel's job. Or do you think you know better than the very sophisticated processing and scheduling models that the kernel support - and should override that and control that from userspace?
    I fear that particular instances overallocate CPU resource on the host and this affects performance of other instances on the host if CPU_COUNT value is set to default for every instances. Sounds like baloney to me. What you fear and not not fear does not change reality. What is the reality? What is the problem? In crystal clear technical details?

  • What are some ways to tell if my charger is frayed?

    What are some ways to tell if my charger is frayed? I plan on going to the apple store soon and asking, However I will busy for the next couple weeks. I know
    that you wont be able to say for certain, just best guesses. I am not sure if its fraying or just improper use because I bought the laptop from a small computer shop near my university. It is a late 2008 Macbook pro 15 inch(Not sure if that extra information helps but just in case ).

    vance0688 wrote:
    What are some ways to tell if my charger is frayed? I plan on going to the apple store soon and asking, However I will busy for the next couple weeks. I know
    that you wont be able to say for certain, just best guesses. I am not sure if its fraying or just improper use because I bought the laptop from a small computer shop near my university. It is a late 2008 Macbook pro 15 inch(Not sure if that extra information helps but just in case ).
    Your charger is frayed

  • What are the ways to handle Idocs which are failed to post to R/3

    Hi Experts
    What are the ways to handle Idocs which are failed to post to R/3  after sucessfully configuration of the Scenario.
    Thanks & Regards
    Aravind

    Hi
    Check the Idoc Status in R/3 with WE05.
    Idocs will fail in following conditions
    1) Idoc will be in error if all the mandatory field are not mapped.
    2) If partner profile is not maintained.
    3) Most of the times, idocs will be in error due to functional issues.....check the status and take help from functional guys.
         Once the error resolved, reprocess the same idoc using BD87
    Regards
    Abhijit
    Edited by: Abhijit Bolakhe on Mar 18, 2010 3:11 PM

  • What are different between gateway and mangement server in scom ?

    Hi all,
    can anyone let me know What are different between gateway and mangement server in scom ?
    thanks,
    Sengottuvel M

    Hi,
    Hope this can answer you question
    About Gateway Servers in Operations Manager
    http://technet.microsoft.com/en-us/library/hh212823.aspx
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • What are different vru types and their functions

              Dear experts,
    what are different vru types and their functions       

    Hi,
    just hit the Help button in "Network VRU Explorer" in ICM Configuration Manager.
    If you wish to see even more details, take a look at the following article:
    http://www.ciscopress.com/articles/article.asp?p=1822061&seqNum=2
    HTH
    G.

Maybe you are looking for