.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Interview Question >> C# >> Post New Question Subscribe to Interview Questions

How to pass the arguments in thread by passing the arguments in start() method.

Posted By :Syed Shakeer Hussain     Posted Date :September 19, 2010    Points :10   Category :C# 
Thread t1 = new Thread(new ThreadStart(obj.abc));

You can also find related Interview Question to How to pass the arguments in thread by passing the arguments in start() method.  below: 

Which method will get executed first, if you have two methods in Javascript with same name and arguments?

The second method will get executed and the first method will not be referred. (More...)

How can you reference current thread of the method ?

"Thread.CurrentThread" refers to the current thread running in the method."CurrentThread" is a public static property. (More...)

How do I call a member method and pass a primitive type (Value Type) by reference?

Use the ref keyword when declaring the parameter of the method, for example:

public bool GetValue( ref int returnValue );

This will pass the numeric by reference.You can modify the value of returnValue within the body of GetValue and it will persist when the method call returns. (More...)

How to pass a value from a method to a property procedure in c# win application?

Here is my code:

class Jewellery : Connectionstr

string lmcode;

public string LM_code//Here i want to access the value of the method(ReadData) i.e displaystring and store the value in to the insert query below.
get { return lmcode; }
set { lmcode = value; }


string mname;
public string M_Name
get { return mname; }
set { mname = value; }

string desc;
public string Desc
get { return desc; }
set { desc = value; }

public string ReadData()
OleDbDataReader dr;
string jid = string.Empty;
string displayString = string.Empty;
String query = "select max(LM_code)from Master_Accounts";
Datamanager.RunExecuteReader(Constr, query);

if (dr.Read())
jid = dr[0].ToString();
if (string.IsNullOrEmpty(jid))
jid = "AM0000";
int len = jid.Length;
string split = jid.Substring(2, len - 2);
int num = Convert.ToInt32(split);
displayString = jid.Substring(0, 2) + num.ToString("0000");
return displayString;//I want to pass this value to the proeprty proc above i.e LM_code.

public void add()

String query ="insert into Master_Accounts values ('" + LM_code + "','" + M_Name + "'," + "'" + Desc "')";
Datamanager.RunExecuteNonQuery(Constr , query);

} (More...)

what is the use of Command Line Arguments?

on start ->Run a run prompt appears and you type notepad.exe to runt he notepad application. Suppose you want to open particular file in notepad you can pass the command line argument like

Notepad.exe c:\MyLogFile.txt

The above statement will open the notepad application with the mentioned filed name.

Comming to programming life i would like to give few examples, which indicates the importance of command line arguments

1. Invoking a com component with different performance options
devEnv.exe /SafeMode
devenv.exe /reset
devenv.exe /nosplash
such command line arguments are used to start the application with different configuration settings

2. Start the executable with different language code passed during the execution
MyApplication.exe /en-US
MyApplication.exe /en-UK
MyApplication.exe /in-HN

It is upto the MyApplication.exe to handle how the command line arguments are used.

3. Suppose you have an application which should run differently depending on the client code or location code .You can pass thorugh command line.

static void Main(strng[] args) here args array recieves the command line arguments when invoking the program
args[0] 1st parameter
args[1] 2nd parameter and so on.... (More...)

In a Java multithreading program, under what circumstances will you call the yield() method of a thread?

1, To give other runnable threads a chance to execute.
2, To start a new thread.
3, To terminate the current thread.
4, To stop the current thread for a specific time.

Answer : 1 (More...)

How can you reference current thread of the method ?

"Thread.CurrentThread" refers to the current thread running in the
method."CurrentThread" is a public static property. (More...)

How to start a thread with parameter?

Use ParameterizedThreadStart type instance (More...)

Which method use to run a new thread?

ThreadPool.QueueUserWorkItem (More...)

How do you call a Member method and pass a value Type by reference?

use the "ref" keyword when declaring a Parameter of the Method
public bool GetValue(ref int returnvalue);

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend