|
This section is for C# Applications. not for Web app.
I think you are using ASP.NET that uses same sytax.
I Suggest look into ayax
|
|
|
|
|
I can't tell you how to display the time zones, but to get them and get their time, look at the TimeZoneInfo class. It's got a method to get every time zone, and another method called ConvertTime. Both of those should be useful
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
string versus String !
I have a question (a little embarrassing because I see it so late), what is the difference between String and string ? not in the way that String is a Class and string is a reference type. But rather how to think about them in the term of uses.
I searched and find this piece of gold, but I don't know how to use it very well:
Use "String" to refer specifically to the String class.
Use "string" when referring to an object of the String class.
How to use them, accordingly?
thanks again.
|
|
|
|
|
String == string. They're aliases of the same class, just like ulong is an alias of UInt64
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
They are the same.
If you want to use reference try like this:
String someString = "";
DoSomething(ref someString);
Function:
private void DoSomething(ref String str)
{
str = "Was Empty";
}
|
|
|
|
|
Why is the ref keyword added to String in this example. Isn't string a reference type already? I thought ref is only to make value types behave like reference types.
|
|
|
|
|
humayunlalzad wrote: Why is the ref keyword added to String in this example. Isn't string a reference type already? I thought ref is only to make value types behave like reference types.
I realy don't know about string, but i must have put into where i have struct type.
|
|
|
|
|
Hi,
I suggest you run something similar to this:
string str="aha";
log(str);
func1(str);
log(str);
func2(ref str);
log(str);
private void func1(String str) {str = "Changed"; log("1 "+str);}
private void func2(ref String str) {str = "Changed";log("2 "+str); }
private void log(string s) {Console.WriteLine(s);}
and think about why it behaves the way it does.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
There is no difference. string is the C# alias to String (which is really System.String ). When the code compiles, all of your string types are converted to System.String in the IL.
Personally, I prefer using string when I am typing a variable and String when I am acessing static members of the class. This is only personal preference as I think it makes the code easier to follow. There is nothing wrong with code like:
bool empty = string.IsNullOrEmpty(""); instead of
bool empty = String.IsNullOrEmpty("");
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
thanks....now I see.
|
|
|
|
|
Glad to help.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Scott Dorman wrote: I prefer using string when I am typing a variable and String when I am acessing static members of the class.
Me too, except I type System.String .
|
|
|
|
|
as System.Boolean.True hasn't been provided, do you also type System.Boolean.Parse(System.Boolean.TrueString) instead of true ?
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Don't tempt me; every once in a while I think about not using any of the aliases at all (they're all just syntactic sugar after all). Unfortunately they're required to specify base types for Enumerations .
|
|
|
|
|
I have great news for you:
System.String
System.String
System.String
The second one has "lang=none" in the CODE tag.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Cool, is stuff like that documented somewhere? (am I just bad at searching?)
|
|
|
|
|
I trust it is, however for harmless things like that, I just experiment a bit.
I always allow for a few minutes of heuristics before taking the scientific route.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Yes, Chris enlightened me about that a day or two ago. I still say that text should be the default.
|
|
|
|
|
look over this file and tell me how are you thinking in improve it !
I spend an entire night at it.
The idea is to have a MAP (on the paper) and rapidly look over it and "remember" what i must to put when I need it.
it's like a pocket reminder(a very tiny little map).
http://www.sendspace.com/file/p56n1r
of course in time must be the answer....if any...hope so...
thanks again.
|
|
|
|
|
I'm pretty sure the only reason they have a the String class is because Java has a String class.
|
|
|
|
|
I Am Checking with System.IO.Directory.Exsist(), however it will return false either if path doesn't exsist or syntax is incorrect.
How can i detect if syntax is correct
|
|
|
|
|
What do you mean if syntax is incorrect? Can you give an example?
-----------------
Picazo
|
|
|
|
|
Hi,
I haven't tried this yet, however I expect new DirectoryInfo(path) would throw an exception when it doesn't like your path.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
thanks, at least some provblems are solved.
|
|
|
|
|
Hi all,
Sometime ago I wrote some automation tool to get content of some site.
Everything worked fine untill one day...
My C# code creted url string and made http hit. I used HttpRequest and Response.
Request looked like http://somesite.con/param1=a¶m2=b¶m3=c
Now, there was a change in the site and it always makes redirect to the url that looks like:
http://somesite.con/param1=a¶m2=b¶m3=c&rnd=AbCdEfG1.
With the fiddler I saw that actially web browser makes 2 hits:
1. The old one.
2. The new one.
Now the response of the first hit contains some JS code that generates this random code (AbCdEfG1), concatinates it to the main url and makes redirect.
As far as I understand I need to execute this JS from C#. It's may be done in the several ways and seems not too complex to do.
But then I need to or:
a. get back this random value from JS.
b. allow to JS to make redirection, but need to get back the response.
I prefer the b. because code that generates this random value always different (code generation or something).
The code of JS is something like that:
html>
<head>
<title></title>
</head>
<script type="text/javascript">
function redirect()
{
var redirectLoc = window.location.href;
if (redirectLoc.indexOf ('?')>-1) redirectLoc +="&"; else redirectLoc+="?";
redirectLoc = redirectLoc.replace (/rnd=[0-9a-zA-Z]+&/,"");
window.location = redirectLoc+'rnd='+f1();
}
</script>
<script type="text/javascript">
function sbbpWvum()
{
nCc = typeof "zCa";
return String.fromCharCode(nCc.charCodeAt(4)^37);
}
function f1()
{
return sbbpWvum();
}
Any one can help with this isue?
Thanks.
modified on Friday, August 14, 2009 10:04 AM
|
|
|
|