convert_lower_upper.htm
Objectives :
  • crreate a library : csc /target:library convert_upper.cs
  • Refer the namespace with "using" key word
  • create dll : csc reference:convert_upper.dll
using System;
//csc /target:library convert_upper.cs
// Unfortunately, the String class in the
//.NET Framework is sealed; therefore,
//you canít derive from it.
namespace C_Cap
{
public class ucap
{
public static string Ucase(string str)
{
str = str.ToLower();
string strempty = "";
char[] chEmpty = new char[]{' '};
foreach (string search in str.Split(chEmpty))
{
strempty += char.ToUpper(search[0]);
strempty += (search.Substring(1, search.Length - 1) + ' ');
}
return strempty;
}
}
//end of the name space
}
using C_Cap;
using System;
//csc reference:convert_upper.dll //try_case.cs

class test
{
static void Main()
{
Console.Write("Write a sentence :");
string str = Console.ReadLine();
string con_str = ucap.Ucase(str);
Console.WriteLine("Line Entered :" + str);
Console.WriteLine("Line Changed :" + con_str);
}
}
 
 
Back to void or return