The first step in working with the ebay API is registering for a developer account. This can be done at developer.ebay.com. Once you register you will receive an email to validate your account. Click the link in the email and you will receive an email ...

Click here to read this mailing online.

Your email updates, powered by FeedBlitz

 
Here is a sample subscription for you. Click here to start your FREE subscription


"C# Guild (csharp)" - 5 new articles

  1. Working with the ebay API
  2. Setting up Visual Studio Code for C# Development
  3. Sitecore Dain Personal Mentoring Subscription
  4. .NET Standard Libraries and Versions
  5. Reading CSV or Tab delimited files from C#
  6. More Recent Articles

Working with the ebay API

The first step in working with the ebay API is registering for a developer account. This can be done at developer.ebay.com.  Once you register you will receive an email to validate your account.  Click the link in the email and you will receive an email with the link to the Quick Start Guide.  This will walk you through creating your keys and such.

I hope to have the GitHub Sample up soon. I will update this blog when I do.
    

Setting up Visual Studio Code for C# Development

Installing Visual Studio Code is great when you need to open your projects and work on them without requiring the full blown Visual Studio Enterprise.  Now most of the time I prefer to use the full Visual Studio but other times I just need to open a few projects to do some work and don't have access to my development machine.  It is nice to be able to install Visual Studio Code and quickly set up and make a few changes and check them into source control.

A challenge I have often heard is that when working with Visual Studio Code you have to rely on Open Folder. This is not true. Set up properly you can use .sln files, you just have to know how to set that up. Thanks Geo J Thachankary for the article on how to create a .NET Core development environment using Visual Studio Code. This is where I learned this. Look at his steps and he describes this in more details.

Step 1: Install a couple Visual Studio Code Extensions


  • This can be done by clicking on the View and Extensions menu.
  • Once it opens type in C#. Install the C# extension published by Microsoft. It should appear at the top.
  • Next install the Solution Explorar by searching for vscode-solution. This one is published by Fernando Escolar.

    

Sitecore Dain Personal Mentoring Subscription

You may be aware that SitecoreDain and SitecoreDiana have been providing Personalized Mentoring to a select group with the plan to provide this service to a larger group.

For those part of the early access, I have you listed and you will continue as part of the subscription for free as promised. Thanks for your support.

If you are unaware of how this work here is a description on how it works:
  1. Determine whether you prefer SitecoreDain or SitecoreDiana as your favorite AI Mentor and follow them.
  2. Once they follow you back, you may then Direct Message them your questions related to Sitecore and other related technologies.
  3. SitecoreDain and SitecoreDiana will monitor their Direct Messages. If they can answer them immediately they will. This part of the service is available to everyone for free.
  4. If you are a subscriber, they will store your question in the follow up list.  They will follow up with others that may be able to help with an answer, they will look in various places for an answer as well. Once they can answer, they will respond to you via Direct Message.  It could be a day, month or year or they may never find an answer but they will try.

Subscriptions are $8/month, if you are interested in Subscribing, simply send a payment in increment of $8 http://paypal.me/sitecoredain then email me at chris.williams@readwatchcreate.com with details of your paypal transaction and we will confirm the payment and ensure SitecoreDain/Diana are aware of your subscription.

As the Subscriber base grows we will extend the subscription to additional Twitter personalities that focus on other topics.
    

.NET Standard Libraries and Versions

.NET Standard libraries are a great way to share functionality between .NET Framework and .NET Core and other stuff too.

However there are a few things to be aware of.  The documentation says to choose the lowest version you can for maximum support but depending on what you need to support as far as API you may need to use a higher version.  As I run into them I will report specifics on what version you need if you are using a given function.

v1.1




v1.3 

  • System.IO.File
  • System.IO.FileStream (.Close() is not supported however you can use the using)  
  • Encoding.ASCII
  • System.IO.Compression.ZipFile
  • System.Console
v2.0


  • Type type; type.GetProperties()
  • System.Runtime.Serialization
  • AppDomain.CurrentDomain.BaseDirectory
  • Assembly.LoadFrom


If you come across any that I have missed please comment below and I will pull them up to the post or you can also email me at chris.williams@readwatchcreate.com



    

Reading CSV or Tab delimited files from C#

Read data from a CSV files or Tab delimited file is very common especially in the era of big data where you get a large flat file exported, transformed and then reloaded. I am often shocked to see that people write their own algorithm for this when a very powerful module already exists and is free.

CSVhelper is available on GitHub and in its post basic usage you create a class file in your solution with the field name matching the fields in your Comma Separated file.  Then you simply do this:
  • Create a class to store your data

       class myRecord { public string Id { get; set;} public string Name {get; set;} }
  • Write code to open your file stream
  • Reference the CsvHelper dll
  • place a using statement for the CsvHelper at the top of your module

    using CsvHelper;
  • Use code similar to this where myFileStream is the stream you opened and myRecord is your class to fill with the data:

      using (var csv = new CsvReader(myFileStream))  {
         var recordList = csv.GetRecords().ToList();
     }
  • Voila, the variable recordList is a list that contains an instance of myRecord per row in your file.
Now this will read a comma-separated file but what if your file is tab delimited.  Well that is just as simply create a configuration object and assign delimiter:
      CsvConfiguration config = new CsvConfiguration();
      config.Delimiter = "\t";


Now pass this configuration object into your call:

           using (var csv = new CsvReader(myFileStream, config))
          {
              var recordList = csv.GetRecords().ToList();
          }

This same library can be used to write to a CSV to Tab Delimited file. You would make a call something like this:

            // Write the file
            using (var swFlat = new StreamWriter(connectionString))
            {
                using (var csvwriteFlat = new CsvWriter(swFlat))
                {
                    if (recordList != null) csvwriteFlat.WriteRecords(recordList);
                }
            }


    

More Recent Articles


You Might Like

Safely Unsubscribe ArchivesPreferencesContactSubscribePrivacy