|
just i want the code for reversing a string through an array.
|
|
|
|
|
Try doing this.
Array.Sort<string>(new string[] {"j", "a", "y", "a", "n", "t"});
Array.Reverse();
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
hi
you can do this:
<br />
String s = "the string to convert";<br />
char [] array = s.ToCharArray();<br />
char[] newArray;<br />
int count = 0;<br />
for (int i = array.Length - 1; i >= 0; i--)<br />
{<br />
newArray[count] = array[i];<br />
count++;<br />
}<br />
String newString = new String(newArray);<br />
there should be more flexibale methods.
but this came to my minde right now knowing that you have some conditions that it should be done using an array.
hope it helps best regards
|
|
|
|
|
quiteSmart wrote: array[i] = newArray[count];
Or perhaps the other direction...
---
b { font-weight: normal; }
|
|
|
|
|
Yea your right,
a small mistake.
i corrected it now
thanks
|
|
|
|
|
Try this...
string string1 = "String To Reverse";
string string2 = string.Empty;
StringBuilder sb = new StringBuilder();
char[] sArr = string1.ToCharArray();
for (int j = sArr.Length - 1; j >= 0; j--)
sb.Append(sArr[j].ToString());
string2 = sb.ToString();
|
|
|
|
|
string message = "!dlrow olleH";<br />
char[] temp = message.ToCharArray();<br />
Array.Reverse(temp);<br />
message = new string(temp);
---
b { font-weight: normal; }
|
|
|
|
|
nice and short
good work
|
|
|
|
|
If you want extra credit in the class, use recursion.
|
|
|
|
|
hi all,
this is my first mail to the forum...Plz let me know the answer for this ASAP.
here is my Problem:
public class R01Struct {
/// <remarks>
public AnImpositionType Annee;
/// <remarks>
public string NoReleve;
/// <remarks>
public R01StructIdentification Identification;
/// <remarks>
public Adresse2Struct Adresse;
/// <remarks>
public R01MntStruct Montants;
}
public class R01StructIdentification {
/// <remarks>
[System.Xml.Serialization.XmlElementAttribute("RaisonSociale", typeof(R01StructIdentificationRaisonSociale))]
[System.Xml.Serialization.XmlElementAttribute("Employe", typeof(R01StructIdentificationEmploye))]
public object Item;
}
public class R01StructIdentificationEmploye {
/// <remarks>
public string NAS;
/// <remarks>
public string No;
/// <remarks>
public string NomFamille;
/// <remarks>
public string Prenom;
/// <remarks>
public string Initiale;
}
there are two classes in one of my code files in my c#window application.my problem is i am trying to acces the content of the "R01StructIdentificationEmploye" by taking a varible of type R01Struct.
here is my old code when the identification class was not there.
((R01Struct)REL1.Items[i]).Employe.NAS = row["NAS"].ToString()"" ? "000000000" : row["NAS"].ToString();
pls give me the solution as soon as possible
vamsee krishna
|
|
|
|
|
Are you creating an instance of that class in your R01Struct contructor?
|
|
|
|
|
hi
I'm working a windows application project in C# and I was wondering how can we make or use icons for our application u know. It requires .ICO file and many softwares dont sopport making these so what should I do.
do u know of any site where some good icons are available or somethin like that
thanks in advance
Rocky
|
|
|
|
|
u can get it from any book of C# like of deitel,where code and idea is given to place information,exclamation,error and other icons on application.
|
|
|
|
|
AS a (bad) workaround, you can place a bmp is your resources and convert it into an icon:
Bitmap bmp = (Bitmap)resources.GetObject("myBMP.bmp");
IntPtr Hicon = bmp.GetHicon();
Icon newIcon = Icon.FromHandle(Hicon);
Then do what you want with it.
|
|
|
|
|
thats good but isnt there anyway we can make these icon files easily.
I'll try that surely...
thanks a lot
Rocky
|
|
|
|
|
I'm trying to implement message queuing in C# .net using MQSeries .. I have the Websphere server installed on a machine and i've tried implementing queuing on that machine .Local queuing without using channel information works fine on the machine where the server is installed .I tried installing MQ client on the client machine but it still is unable to connect.Everytime i try to connect to the system remotely and access the queues , i get an error saying dll not found.I tried to resolve this by copying all dlls frm the bin folder of the MQ client to system32 but that didnt help.
The exception is raised when the queue manager object is initialized . Even when i try to connect to the server from the same machine using channels ,it gives an MQRC_Environment_error .. or MQCONN error.Does anyone have a solution ??
Jake
|
|
|
|
|
I am Coming accross the problem "attempt to store an element of the incorrect type into the array "when i tried to add my UI during the design time.Please tell me what am i need to do overcome this problem.Thanks in advance
Regards,
Guru
|
|
|
|
|
Can you please be little more specific what exactly you want and what exactly you have done. Does problem mean exception? Try to exlplain in details, so that somebody can suggest right solution.
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
Too vague to help you. What exactly are you doing (include steps)? What is the exception that occurs?
|
|
|
|
|
what is virtual method,dynamic method,static method
|
|
|
|
|
What is homework ?
What is google ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Virtual methods are those methods which you want to call using base class object with derived class reference.
namespace SomeCorpProject
{
public class BaseBusinessObject
{
public BaseBusinessObject()
{
}
public virtual void VirtualMethod()
{
Console.WriteLine("Virtual method");
}
public override string ToString()
{
return "BaseBusinessObject";
}
}
}
namespace SomeCorpProject
{
public class Capacitor : BaseBusinessObject
{
public Capacitor()
{
}
public static void StaticMethod()
{
Console.WriteLine("I am static, no need to create object of class.");
}
public override void VirtualMethod()
{
Console.WriteLine("In derived virtual method");
base.VirtualMethod();
}
public override string ToString()
{
return "Capacitor";
}
}
}
namespace SomeCorpProject
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
BaseBusinessObject bizObj = new Capacitor();
bizObj.VirtualMethod();
Capacitor.StaticMethod();
System.Console.WriteLine(bizObj.ToString());
}
}
}
The above code will explain most of the concepts. Static methods are those methods for which object of the class need not to be created. They share the common info across all class objects. They are loaded in the memory before class gets loaded. Dynamic methods? I do not have idea. But I think they might be instance methods. i.e. you should create an object of the class to call these methods.
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
jdkulkarni wrote: Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
Wow - is that worth something in parts of the world ?
I wouldn't have given the answer, because all you're doing is teaching this person to not do their own homework. I hope he ends up working in the cubicle next to you and not near me.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
As far as hand feeding, I couldn't agree more. Unfortunately, I think I do sit next to him
|
|
|
|