Posts

Showing posts with the label dotnet compatible

C# 7.0 Potential Features – Local Functions

Image
Thoughts on C# 7.0 Local Functions. Potential Features - Local Functions Frankly, when I first tried this, I thought that it's just a nice and compact way of defining local helpers. In fact, it's much more interesting and useful feature. Today I'm going to explore and explain it in more details. Let's  start with a brief overview of the current situation. Before Local Functions Private methods The first option that existed in C# 1 is having a private method. That’s a clean and simple solution. It has few issues, though. PrintMe might have no sense outside of ThatTime method, but it’s accessible for every other method inside the class. It will be taken into account by IntelliSense. Func and Action We can try to hide our helper inside the scope of ThatTime method by converting it to Func<int, string>: Any disadvantages ?? Yep, a lot. The call is unnecessary expensive: it will produce  more all

Make it Easy by Angular-JS Directive to Format or Filter Date

Image
There is always a havoc on handling dates in the application either it's java /dot net or angular . So here is the best way I found in order to overcome the problem . Date Directive Here I am going to explain about angular date filtering concept and how to  use filtering concept to filter Date across your application.It is always better to create a date.js file for those filtering concept.  The advantage of this is you can very easily filter the data anywhere in your view by just placing directive. This can be achieved by using following code in your module defined, for example : CYW.date below. angular.module('CYW.date', []) .filter('stringToDate', function () { return function (input) { /// gets Date input, if not, returns null. Also sets the date to /// correct format if (!input) return null; var date = moment(input); return date.isValid() ? date.format('MM/DD/YYYY') : null; }; }

C# 7.0 Potential Features – Tuples

Image
In this article, let's discuss on Tuple Class in C# and the potential new proposals that are being considered for C#7. Potential Features - Tuple What is Tuple in C#? Basically, a  tuple  ( Tuple in C# ) is an ordered sequence, immutable, fixed-size and of heterogeneous objects, i.e., each object being of a specific type. The  tuples  are not new in programming. They are already used in F#, Python, and databases. A tuple allows you to combine multiple values of possibly different types into a single object without having to create a custom class. This can be useful if you want to write a method that for example returns three related values but you don’t want to create a new class. System.Tuples namespace supports Tuple class in C#. The purpose of a tuple is to create a way to return multiple values from a function. class CodeYourWayTupleDemo { static void Main() { // Create three-item tuple. Tuple tuple = new Tuple (10, "Code

Google Translator using Windows forms

Image
This latest version of GoogleTranslator utilizes Google Translate's AJAX APIs to translate text and retrieves the translation by parsing the returned JSON content.  What is it? Sample Application beta Version GoogleTranslator is an object that allows you to translate text using the power of Google's online language tools. This demo  allows you to easily perform a reverse translation. The app can be used as a poor man's resource translator for simple phrases, but you'd be wise to confirm the translation with a native speaker before using the results. How do I create it? You use Google Api to get translated text to Target language you specify. string sourceLanguage =sourceLang; string targetLanguage = targetLang; string urlNew = string.Format("https://translate.googleapis.com/translate_a/single?client=gtx&sl={0}&tl={1}&dt=t&q={2}", sourceLanguage,

Much Awaited Release .NET Core 1.0 !!!

GETTING STARTED WITH .NET CORE To Start With : . NET Core 1.0 runs on Windows, Mac, and several flavors of Linux including RedHat Enterprise Linux and Ubuntu. It supports C#, VB, and F# and modern constructs like generics, Language Integrated Query (LINQ), async support and more. The Core Runtime, libraries, compiler, languages and tools are all open source on GitHub where contributions are accepted, tested and fully supported. If you use Visual Studio 2015 (and remember,  Visual Studio Community is free !) you  should get VS2015 Update 3 first  then install the  .NET Core Tools for Visual Studio . If you don't want to use VS, consider using  Visual Studio Code  for free and install the  C# extension  from the marketplace to get a great code editing experience along with the  .NET Core SDK for Windows . Of course, if you're on Mac/Linux/Whatever, go over to  http://dot.net  and download whatever's right for you! If you want all the  advanced and specific downloads for .NET

Getting Started with Umbraco: Part 4

Image
In this part, we'll start off by adding another XSLT file (for the news item pages), and then move on to look at how we can integrate standard .Net User Controls to Umbraco. Also available in this series: Getting Started with Umbraco: Part 1 Getting Started with Umbraco: Part 2 Getting Started with Umbraco: Part 3 Getting Started with Umbraco: Part 4 Adding the newsList Macro Create a new XSLT file (and macro) in the back-end and call it newsList . In this XSLT file we'll be using a non-standard entity, which is the HTML entity &\mdash; . In order to use this entity we need to define it in the entity list in the XSLT doctype declaration at the top of the file. To add the mdash entity add the following code within the square brackets directly after the defined non-breaking space entity: < ! ENTITY mdash " &#x2014; " > We'll save a variable so that we can easily access the newsList node in order to get its child nodes. Directly after the currentPage p