Category Archives: misc

Csharp concepts

Csharp concepts

Multilingual textbox csharp

Following code in C# helps to type in english the hindi words   and are scripted as hindi :

Multilingual textbox csharp

Multilingual textbox in csharp


<html xmlns="http://www.w3.org/1999/xhtml">

<head id=”Head1″ runat=”server”>

<title>Hindi Textbox Demo</title>

<script src=”https://www.google.com/jsapi” type=”text/javascript”>

</script>

<script language=”javascript” type=”text/javascript”>

google.load(“elements”, “1”, { packages: “transliteration” });

function onLoad() {

var options = {

//Source Language

sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,

// Destination language to Transliterate

destinationLanguage: [google.elements.transliteration.LanguageCode.HINDI],

shortcutKey: ‘ctrl+g’,

transliterationEnabled: true

};

var control = new google.elements.transliteration.TransliterationControl(options);

control.makeTransliteratable([‘TextBox1’]);

}

google.setOnLoadCallback(onLoad);

</script>

</head>

<body>

<form id=”form1″ runat=”server”>

<div>

<asp:TextBox id=”TextBox1″ runat=”server” style=”border: 1px solid black; height: 125px; margin-left: auto; width: 550px;” textmode=”MultiLine”>
</asp:TextBox>
</div>

</form>

</body>

</html>

Write above code in .aspx files and then run to get the output.

Advantage of task over thread

Task provides following powerful features over thread.
  1. If system has multiple tasks then it make use of the CLR thread pool internally, and so do not have the overhead associated with creating a dedicated thread using the Thread. Also reduce the context switching time among multiple threads.
  2. Task can return a result. There is no direct mechanism to return the result from thread.
  3. Wait on a set of tasks, without a signaling construct.
  4. We can chain tasks together to execute one after the other.
  5. Establish a parent/child relationship when one task is started from another task.
  6. Child task exception can propagate to parent task.
  7. Task support cancellation through the use of cancellation tokens.
  8. Asynchronous implementation is easy in task, using’ async’ and ‘await’ keywords.