Show / Hide Table of Contents

    IDataUnpacker.GetRaw(string key) Method

    .NET Standard 2.x

    Gets the raw string of text for the specified element.

    Namespace: SnapObjects.Data

    Assembly: SnapObjects.Data.dll

    Syntax

    string GetRaw(string key);
    

    Parameters

    key System.String

    The key specifying which element to get the raw string of text.

    Returns

    System.String

    Returns the raw string of text for the element if the key exists; otherwise, returns String.Empty.

    Examples

    The following code example gets the original text of the specified key of IDataUnPacker object.

    using SnapObjects.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataUnpackerExamples
    {
        public class GetRawExample
        {
            private readonly SchoolContext _context;
    
            public GetRawExample(SchoolContext dataContext)
            {
                // Sets the data context.
                _context = dataContext;
            }
    
            public void Example(IDataUnpacker dataUnpacker)
            {
                // Gets the original text of Key1.
                string rawText = dataUnpacker.GetRaw("student");
    
                Console.WriteLine("Raw Text :");
                Console.WriteLine(rawText);
    
                /* This code example produces the following output:
                
                Raw Text :
                [
                  {
                    "personid": null,
                    "lastname": "Sherwood",
                    "firstname": "Lena",
                    "hiredate": null,
                    "enrollmentdate": "2019-01-01 00:00:00",
                    "discriminator": "Student"
                  }
                ]
                */
            }
        }
    }
    

    Example Refer To

    Controller Class: GetRawExampleController

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon