|
sheesh, you beat my by two minutes.... hehe... that's what I get for reading down the page first
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Mike Ellison wrote:
What is the technical difference between defining a string this way:
string s = "this is my string";
and this way?
string s = @"this is my string";
Well the first would try to escape certain characters followed by a slash
string s = "this is a line \n with a newline embedded";
string s = @"this is a line \n with a slash n embedded";
The @ sign tells the compiler "this is a literal string, don't escape the characters after the slash".
Hope this helps,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
|
|
Mike,
It looks like everyone has answered you question here. I just wanted to add that strings that are defined with the "@" sign are called verbatim strings.
-Nick Parker
|
|
|
|
|
Thanks, Nick. Every bit of useful information helps!
|
|
|
|
|
What is the difference between different types of report in crystal report like crosstab, sub report etc as when i have developed i these report i cannot tell by watching them that this is sub report or this is crosstab or this is drill down. My question is actually that what makes these reports different from one another or what is the basic property that will be in one report so that we can say that this is standard, this is crosstab etc. please answer it thoroughly. thanks
Inam
|
|
|
|
|
|
The difference between readonly and const is _not_ just that readonly can be initialized in the constructor. Readonly variables are still variables, i.e. they are a location in memory that contains a value. Const's are just values known at the compile time and they are burned into whatever code references them at compile time, not looked up at execution time like readonly's.
The compiler needs to know the values in the switch statement to generate the code optimally.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
|
I use readonly regurlarly for ArrayLists and Hashtables
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
readonly are very good for default parameter values, because they don't introduce versioning problems. With const, the value can be splattered all over several DLLs, and if you need to change a constant value, you'll need a full recompile (sometimes impractical, specially if you are writing a framework). With readonly, you have full control of the value of a constant.
Help me dominate the world - click this link and my army will grow
|
|
|
|
|
Building on what leppie and Daniel have said:
You cannot use const in conjunction with your own data types* because they need to be complete at compile time. You can however use readonly with your own data types.
Another scenario is instances where something should be treated as a constant but can't because the constant can change depending on certain behavior. For instance, a class which will perform currency conversion; depending on the two currencies being converted the factor will differ. You can of course expose this factor as a read-only property, but there is nothing to stop your code from changing that value once an instance has been created. If you make the factor readonly though the compiler will ensure you don't change the factor after creating an instance of the class.
Bad example, I know, but just one possibility
James
"then when you go to bed...wait, you dont do that do you....ok....when you plug into the 'hive mind' to charge yourself, ill hack into your head"
Nnamdi Onyeyiri over MSN
|
|
|
|
|
I am having problems creating large Bitmap object. I am using the Bitmap class in C# and my application requires the creation of a large (greater than 46340 x 46340) image. During execution of:
Bitmap bmp = new Bitmap(width, height);
I get the System.ArgumentException when the width value is set to 46341 and the height value is set to 46341. I dont get this error if the imagesize is 46340x46340. I understand that I am crossing the limit of a signed 32bit integer with the value of 46341x46341. Is this a limiting factor? How do I get around this problem.
I would appreciate any help.
Thank you.
-SpinD
|
|
|
|
|
If this is not a monochrome bitmap, i.e. 1 bit per pixel, then give up now. You only have 2GB of address space to work with using the current CLR on Win32. Even an 8bit palette image of that size would no longer fit in memory.
If you really need to work with images that size obviously you aren't displaying them on the screen, so don't try to load them all into memory. Don't use Bitmap; treat them as data on the disk.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
Hi
How can i access COM Ports in C#
raheela
|
|
|
|
|
Perhaps this[^] would help.
Beyond that, there are probably some other samples on www.gotdotnet.com[^] but that one looked the most promising in a search for com port another search that might work well is one for serial port.
Good luck,
James
"then when you go to bed...wait, you dont do that do you....ok....when you plug into the 'hive mind' to charge yourself, ill hack into your head"
Nnamdi Onyeyiri over MSN
|
|
|
|
|
Hi all,
I'm working in a project that uses DataSets and I found a trouble shotting trying to set up in ordering a column of a table contained in the data set, in order to achive I use DataViews, this DataView works perfecly, then I retun the ordered data to the DataSet and then retun this DataSet as WebMethod but the data does simple not work, do anyone know what is the problem??, here is an code of my development...
tnks
public DataSet MyMethod(DataSet myDS)
{
// this data view is working perfecly
DataView myDView = new DataView(myDS.Tables[tablename], "", <column asc="">, DataViewRowState.CurrentRows);
// I'm doing this remove because if doesn't it causes assignment problems
myDS.Tables.Remove(tablename);
// I'm trying to assign the ordered data to the DataSet
myDS.Tables.Add(myDView.Table);
return myDS;
}
// in this web method does not work properly
[WebMethod]
public DataSet Test()
{
...
DataSet DS = MyMethod(myDS)
return DS;
}
/*********** Om@r ***********/
|
|
|
|
|
Please tell me more about why do you remove and then re-add the table TableName. This can't make sense!
Stefan
|
|
|
|
|
Stefan,
Because if you don't remove it, it results in a read only assign error due to the dependency of the table with the dataview. Yesterday I discover that dataview is in fact a memory pointer table that can not be assigned to any other data struct, try doing a test with a code similar to my code without the removing action and see what happens...
Omar
/*********** Om@r ***********/
|
|
|
|
|
Omar,
So please tell me what you want to do practically. I'm sure that you don't have to remove and re-add your table.
Maybe I can help you.
Stefan
|
|
|
|
|
Stefan
I'm using a method class that receive a dataset, the name or index of a table and the name or index of a columname and the order, I need to retrieve the DataSer ordered by the column indicated, I can not doing this in a DataGrid because the data is not going to be a web method and this data is going to passed to other layer in the structure, also I can not handle the order in the data base because this data table is composed by more than one table of diferent data base tables and computed columns, so in resume, I need to return this DataSet (or a new one) but with the table in question ordered, could you help me about this??
Omar
/*********** Om@r ***********/
|
|
|
|
|
public DataSet YourMethod(String Table, String Column or DataColumn dc)
DataTable dt=DataSet.Tables[Table];
DataRow[] rows=dt.Select(strExpr, Sort, RowState)
better:
DataSet.Tables[Table].DefaultView.Sort="ColumnName DESC";
Perhaps you don't know that you can bind your DataGrid to a DataView, too!
DataGrid.DataSource=DataSet[Table].DefaultView;
If I did not understand your needs try to reexplain or use another language to tell me. German or French, perhaps?
|
|
|
|
|
Dear STW
Finally I found the solution for my problem, I was pointed to erroneus table and row pointer, here is the complete solution...
Basicly I needed a method which receives a dataset, table name, column name and type order and the return the same (or in a diferente dataset) the same table contained in a data set but ordered by meaning of the column name and type order (Desc / Asc), as I told you, I can not simply Bind the DataView value to a DataGrid because I need to pass a DataSet to other upper layer that performs other transformation for this DataSet like formating, including / excluding columns, etc. Also I could not handle it in the data base (ordering directly the table) because the data set table composed by differents source data like computed columns, added columns from other data bases, etc. That's why a needed to handle this in a Data Set form...
regards and thanks for all...
/************************************************************************/
Private Function OrderTable(DataSet, tablename, columnname, typeorder) As DataSet
Dim ds1 As New DataSet
Dim dt As DataTable
Dim dv As DataView
Dim dr1 As DataRow
Dim a As Integer
Dim drv As DataRowView
dv = ds.Tables(0).DefaultView
dv.Sort = strCol + " " + strOrder
dt = ds.Tables(0).Clone
For Each drv In dv
dr1 = dt.NewRow
For a = 0 To dv.Table.Columns.Count - 1
dr1(a) = drv(a)
Next
dt.Rows.Add(dr1)
Next
Dt.tableName=strTabla
ds1.Tables.Add(dt)
Return ds1
End Function
/*******************************************************************/
/*********** Om@r ***********/
|
|
|
|
|
So you make a View and then copy the sorted rows to another DataTable. Your solution is to create a new DataTable.
Good luck
Stefan
|
|
|
|