Click here to Skip to main content
15,904,655 members
Home / Discussions / C#
   

C#

 
QuestionThe name 'SequentialSearch' does not exist in the current context. Pin
ReynaW122314-Jul-09 15:35
ReynaW122314-Jul-09 15:35 
AnswerRe: The name 'SequentialSearch' does not exist in the current context. Pin
Adam Maras14-Jul-09 15:46
Adam Maras14-Jul-09 15:46 
AnswerRe: The name 'SequentialSearch' does not exist in the current context. Pin
Adam R Harris14-Jul-09 15:49
Adam R Harris14-Jul-09 15:49 
GeneralRe: The name 'SequentialSearch' does not exist in the current context. Pin
Adam R Harris14-Jul-09 15:56
Adam R Harris14-Jul-09 15:56 
GeneralRe: The name 'SequentialSearch' does not exist in the current context. Pin
ReynaW122314-Jul-09 16:20
ReynaW122314-Jul-09 16:20 
QuestionImage coordinates within a picturebox Pin
Quake2Player14-Jul-09 15:19
Quake2Player14-Jul-09 15:19 
AnswerRe: Image coordinates within a picturebox Pin
Quake2Player14-Jul-09 15:37
Quake2Player14-Jul-09 15:37 
AnswerRe: Image coordinates within a picturebox Pin
krishy1928-Jul-09 5:53
krishy1928-Jul-09 5:53 
GeneralRe: Image coordinates within a picturebox Pin
Quake2Player28-Jul-09 7:28
Quake2Player28-Jul-09 7:28 
GeneralRe: Image coordinates within a picturebox Pin
Quake2Player28-Jul-09 7:44
Quake2Player28-Jul-09 7:44 
GeneralRe: Image coordinates within a picturebox Pin
krishy1928-Jul-09 19:37
krishy1928-Jul-09 19:37 
QuestionThe viewable portion of items in a ListBox Pin
GavinSV14-Jul-09 12:59
GavinSV14-Jul-09 12:59 
AnswerRe: The viewable portion of items in a ListBox [modified] Pin
Henry Minute14-Jul-09 13:08
Henry Minute14-Jul-09 13:08 
GeneralRe: The viewable portion of items in a ListBox Pin
GavinSV14-Jul-09 16:24
GavinSV14-Jul-09 16:24 
QuestionWhy is my bitmap file smaller than it should be ? Pin
Paul Carr14-Jul-09 11:47
Paul Carr14-Jul-09 11:47 
AnswerRe: Why is my bitmap file smaller than it should be ? Pin
Christian Graus14-Jul-09 11:58
protectorChristian Graus14-Jul-09 11:58 
GeneralRe: Why is my bitmap file smaller than it should be ? Pin
Paul Carr14-Jul-09 12:11
Paul Carr14-Jul-09 12:11 
GeneralRe: Why is my bitmap file smaller than it should be ? Pin
Paul Carr14-Jul-09 12:13
Paul Carr14-Jul-09 12:13 
GeneralRe: Why is my bitmap file smaller than it should be ? Pin
Paul Carr14-Jul-09 12:17
Paul Carr14-Jul-09 12:17 
GeneralRe: Why is my bitmap file smaller than it should be ? Pin
harold aptroot14-Jul-09 12:20
harold aptroot14-Jul-09 12:20 
GeneralRe: Why is my bitmap file smaller than it should be ? Pin
harold aptroot14-Jul-09 12:19
harold aptroot14-Jul-09 12:19 
GeneralRe: Why is my bitmap file smaller than it should be ? Pin
Christian Graus14-Jul-09 15:17
protectorChristian Graus14-Jul-09 15:17 
Questionusing statements and IDisposable Pin
saxisa14-Jul-09 11:38
saxisa14-Jul-09 11:38 
I'm looking at some code like this (sorry for the formatting):

public static OracleDataReader GetDynamicQueryReader (
OracleConnection con,
string sql,
out string msg)
{

sql = Regex.Replace(sql, @"\s+", " ");
try
{
using(OracleCommand cmd = new OracleCommand(sql, con))
{
cmd.CommandType = CommandType.Text;
OracleDataReader dr = cmd.ExecuteReader();
msg = "Successful";
return dr;
}
}
catch (Exception ex)
{
msg = ex.Message;
con.Close();
return null;
}
}

This little chunk (not mine) is called several thousand times, and from the profiler I am using it is the generation of a new OracleCommand object costing the most. And this object can have its parameters set after instantiation.

Normally I would make this a static, but since I am supposed to instantiate it with a using statement to deal with the disposal of unmanaged references, Im not sure I can. Can I? If I determine that there are no memory leaks with a profiler by creating and disposing some unmanaged reference, can I safely make this static? Or should I really just put up with the poor performance?
AnswerRe: using statements and IDisposable Pin
Christian Graus14-Jul-09 11:59
protectorChristian Graus14-Jul-09 11:59 
AnswerRe: using statements and IDisposable Pin
PIEBALDconsult14-Jul-09 17:09
mvePIEBALDconsult14-Jul-09 17:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.