C# .NET - split string
Asked By sammy mc
06-Sep-10 12:00 AM
Hello techs, I have a input string str="london;usa;paris;germany"; I want to upload the flag depends on the country; wondering best way I split str and create image object on the fly; Thank you!
Anand Malli replied to sammy mc
Hi Sammy,
you can split the string based on separator ';'. & iterate through items to create image object on the fly....
using System;
public class SplitTest {
public static void Main() {
string str="london;usa;paris;germany"
string [] split = str.Split(new Char [] {';'});
foreach (string s in split) {
if (s.Trim() != "")
// Add code to create image object here
}
}
}
I hope u got ur solution....

How can we know a state of a thread? (A) What is use of Interlocked class ? (A) What is a monitor object? (A) What are wait handles? (A) What is ManualResetEvent and Webservices (B)What is an application domain? (B) What is .NET Remoting? (B) Which class does the remote object has to inherit? (I) what are two different types of remote Hidden frames? (I) What are benefits and limitations of using Cookies? (I) What is Query String and What are benefits and limitations of using Query Strings? (I) What is Absolute and 0? (I) What is Post Cache substitution? (I) Why do we need methods to be static for Post Cache substitution? Chapter 6: OOPS (B) What is Object Oriented Programming? (B) What is a Class? (B) What is an Object? (A) What is the relation between Classes and Objects? (B Overriding? (I) what is the difference between delegate and events? (B) If we inherit a class do the private variables also get inherited? (B) What is the different accessibility levels defined in .NET? (I) Can you prevent a class from overriding? (I) what is the use of “Must inherit” keyword in VB.NET? (I Do interface have accessibility modifier. (A) What are similarities between Class and structure? (A) What is the difference between Class and structure’s? (B) What does
assembly info which namespace we should import? System.Reflection Namespace How do you declare a static variable and what is its lifetime? Give an example. Answer1 static int Myint–The life time is during the entire application. br> Answer2 The static modifier is used to declare a static member, which belongs to the type itself rather than to a specific object. The static modifier can be used with fields, methods, properties, operators, events and constructors, but cannot be used with indexers, destructors, or types. In C#, the static keyword indicates a class variable. In VB, the equivalent keyword is Shared. Its scoped to the class in which it occurs. Example a. Static int var / / in c#.net b. static void
Interface and Abstract Class Hai, When do we go for Interface. . When do we go for Abstract Class. . .Give one example Today i faced one interview . . He asked this question.I want answer with Example Thanks in Advance Abstract Class :: - It cannot defines all the methods - It has subclass. - Here, Subclass is useless - A class can be extend an abstract class Interface :: - It defines all the methods - It must have implementations by other classes, But there http: / / kyapoocha.com / c-sharp-interview-questions / what%E2%80%99s-the-difference-between-an-interface-and-abstract-class-5 / http: / / www.dotnetuncle.com / Difference / 4_abstract_class_interface.aspx Hope this helps. HI An interface contains signatures of methods , delegates or events . The implementation of the methods is done in the class that implements the interface, as shown in the following example: interface ISampleInterface { void SampleMethod(); } class ImplementationClass : ISampleInterface { / / Explicit interface member implementation: void ISampleInterface.SampleMethod() { / / Method implementation. } static void
project folder. Then Set the path of the saved images to image control URL. . . . as string strPath = Server.MapPath("image path"); CreatedImage.Save( strPath ); Image1.ImageUrl = strPath ; Hi , But i do image to Image control No other way Use below function in your code. protected override void Render(HtmlTextWriter writer) { if (Site ! = null && Site.DesignMode) { Label DesignerLabel = new Label(); DesignerLabel.Width = this BorderWidth = this .BorderWidth; DesignerLabel.BorderColor = this .BorderColor; DesignerLabel.CssClass = this .CssClass; DesignerLabel.RenderControl(writer); } else { String SaveUrl = null ; if (OnImageRender ! = null ) { Bitmap Bmp = new Bitmap(( int ) this .Width.Value, ( int ) this aspnet / DynamicContentRendering.aspx for details. Let me know if it helps you. -Paresh protected override void Render(HtmlTextWriter writer) { if (Site ! = null && Site.DesignMode) { Label DesignerLabel = new Label(); DesignerLabel.Width = this BorderWidth = this .BorderWidth; DesignerLabel.BorderColor = this .BorderColor; DesignerLabel.CssClass = this .CssClass; DesignerLabel.RenderControl(writer); } else { String SaveUrl = null ; if (OnImageRender ! = null ) { Bitmap Bmp = new Bitmap(( int ) this .Width.Value, ( int ) this Render(writer); if (SaveUrl ! = null ) { ImageUrl = SaveUrl; } } Hi , Vasanthakumar D, I found the way. . . . . . private void WriteProperties(string text , string ImageName) { System.Drawing.Image imImage = System.Drawing.Image.FromFile(Server.MapPath("~ / ") + ImageName); System.Drawing.Imaging