-
Prospect
cegonsoft profile | learn String Type in C# .net
One of the best examples of how class members can replace built-in functions is found with strings. In the past, every language has defined its own specialized functions for string manipulation.
In .NET, however, you use the methods of the String class, which ensures consistency between all .NET languages.
The following code snippet shows several ways to manipulate a string using its object nature:
string myString = "This is a test string ";
myString = myString.Trim(); // = "This is a test string"
myString = myString.Substring(0, 4); // = "This"
myString = myString.ToUpper(); // = "THIS"
myString = myString.Replace("IS", "AT"); // = "THAT"
int length = myString.Length; // = 4
Visit: Cegonsoft
-
Prospect
Cegonsoft dotnet framework 4.0 Training
The biggest issue with boxing is the fact that you are not actually accessing the original object so any changes that you make to the boxed object will not impact the original object. This causes some difficulties if you're not aware of it. For example:
Code Snippet
void Add ( object value1, object value2 )
{
int num1 = (int)value1;
int num2 = (int)value2;
num1 += num2;
value1 = num1;
}
Ignoring the fact that you'd never write code like this it also won't work properly. Because of boxing any int you pass to the method will be wrapped in an object instance. After the method is complete the object instance goes away. The original value type is never modified.
for advanced example in dot net c sharp examples cegonsoft
-
Prospect
Boxing and Unboxing in .NET
Boxing and Unboxing in .NET is used to convert a value type to an object and vice versa. In some cases or programs, values are to be stored in an object and retrieved. In the following program List1 is collection of objects. In that both strings and integers are stored by boxing implicitly. While calculating the sum of integers, unboxing is done explicitly as shown below.
List<object> List1 = new List<object>();
// BOXING //
// Add a string element to the list.
List1.Add("First Group:");
// Add some integers to the list.
for (int i = 1; i < 5; i++)
{
List1.Add(i);
}
// Add another string and more integers.
List1.Add("Second Group:");
for (int i = 5; i < 10; i++)
{
List1.Add(i);
}
foreach (var item in List1)
{
Console.WriteLine(item);
}
// UNBOXING //
var sum = 0;
for (var i = 1; i < 5; i++)
{
sum += (int)List1[i] * (int)List1[i];
}
Console.WriteLine("Sum: " + sum);
Cegonsoft
-
Prospect
The parameter placeholder {0}, {1} etc in Console.Write is handled by the string formatting. The placeholder has to have the index of the parameter but can also include formatting information.
This is used in Console.WriteLine and also string.format hence its inclusion here.
Layout of the PlaceHolder
The three parts are
index, alignment : format
So {0:X} (x means Hexadecimal) or {0,10} meaning output in a width of 10. The alignment value specifies teh width and left or right alignment by using - (left aligned) or + (right aligned) numbers. 10 Means right aligned in a width of 10, -6 means left aligned in a width of 6. Alignment is ignored if the output exceeds the width.
This provides a large number of formatting examples.
List of Numeric Formats
C or C - For Currency. Uses the cultures currency symbol.
D or D - Integer types. Add a number for 0 padding eg D5.
E or e - Scientific notation.
F or f - Fixed Point.
G or g - Compact fixed-point/scientific notation.
N or n - Number. This can be enhanced by a NumberFormatInfo object.
P or p - Percentage.
R or r - Round-trip. Keeps exact digits when converted to string and back.
X or x - Hexadecimal. x - uses abcdef, X use ABCDEF.
Dates can also be specified either using Standard Format strings
O or o - YYYY-MM-dd:mm:ss:ffffffffzz
R or r - RFC1123 eg ddd, dd MMM yyyy HH:ss GMT
s - sortable . yyyy-MM-ddTHH:mm:ss
u - Universal Sort Date - yyyy-MM-dd HH:mm:ssZ
or Format specifiers. There are too many of those to list here - see example 6 for examples using them. I've commented the examples.
This concludes this tutorial. The next C# programming tutorial will be on Windows forms.
cegonsoft
-
Prospect
Software testing is for the checking the detect faults.
Through the software testing establish confidence in software and evaluate properties of software
Reliability
Performance
Memory Usage
Security
Usability
So the software testing is the very important one work in the project development.
Through which only we provide the very good quality product to clients and satisfies the client needs.
In cegonsoft they provide very good training for the software testing.They provide the training in all the advance tools.
So which the students get the good opportunity in the industry to get placement.
Cegonsoft
-
Prospect
Hi,
Cegonsoft is the best IT Training Centre providing training on various technologies including .NET in Karnataka and Tamilnadu.
Their comprehensive .NET course provides in-depth coverage of all .NET features from fundamental to advanced topics.
They also provide Placement Assistance for their trainees and International Certification after completion of Course.
Cegonsoft
-
Prospect
It's useful unboxing program..
Cegonsoft
-
Prospect
The first one looks kind of variable is called a String. String variables are always text. We write a small program that takes the text in the text box to save the text into a variable and then displays the text in the message field.
But remember that a variable is simply a storage area to keep things you will need later. Think of them as boxes in a room. The boxes are empty until you put something in them.
cegonsoft
Last edited by mithunshalom; 10-04-2011 at 09:15 AM.
-
Emerald Star member
The .NET framework created by Microsoft is a software development platform that focuses on
rapid application development, platform independence and network transparency.
.NET is Microsoft's strategic initiative for server and desktop development for the next decade.
According to Microsoft, .NET includes many technologies that are designed to facilitate rapid development
of Internet and Intranet applications. .NET-connected solutions aim to enable businesses integrate their systems more rapidly and in a more agile manner and help them realize the promise of information
on any device.
ASP.NET is a server side scripting technology that enables scripts (embedded in web pages) to be executed by an Internet server.
ASP.NET is a Microsoft Technology
ASP stands for Active Server Pages
ASP.NET is a program that runs inside IIS
IIS (Internet Information Services) is Microsoft's Internet server
IIS comes as a free component with Windows servers
IIS is also a part of Windows 2000 and XP Professional
The .NET Framework is the infrastructure for the Microsoft .NET platform.
The .NET Framework is an environment for building, deploying, and running Web applications and Web Services.
-
Prospect
Microsoft C # is a new programming language designed to create a wide range of business applications that run on the .NET Framework.
C# .NET is mainly a high level Object Oriented Programming Language.
C# .NET is mainly derived from C language.
C# .NET is used to develop following types of applications.
(1) Console Applications.
(2) Windows Applications.
(3) Web Applications.
(4) Class Library Applications.
(5) Windows Control Library Applications.
(6) Web Control Library Applications.
(7) Web Service Applications.
Cegonsoft offers .NET training as industry standards and cover all the advanced concepts as well. The quality of the curriculum is such that most students were placed right after the completion of course.
They also provide comprehensive material for students and exposure to live projects that help students to find the right job.
Cegonsoft
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules