Results 1 to 3 of 3

Thread: How to use properties?

  1. #1
    .NET Framework
    .NET 4.0
    Join Date
    May 2018
    Posts
    5
    Rep Power
    0

    How to use properties?

    How Can I retrieve data through a proprerty in c sharp??




    ---> This method is contained in my main :


    Code:
    static decimal RetrievePower(SDK.Event.ResultEventArgs e)
    {
    
    //Here I want retrieve The data of the properties
    
    }



    Look at inside the SDK.Event.ResultEventArgs class:
    Code:
    namespace Sun.SDK.Event
    {
    public sealed class ResultEventArgs : EventArgs
    {
    public ResultEventArgs(string id, string shop, IList<ResultEntity> result, OperationCode code, object extdata = null);
    
    
    public string StationID { get; set; }
    public string ShopCode { get; set; }
    public object ExtData { get; set; }
    public IList<ResultEntity> ResultList { get; } 
    //--->I don't know how I have to manage the property public IList<ResultEntity> ResultList { get; } 
    public OperationCode OptCode { get; set; }
    }
    }


    Look at inside ClassResultEntity

    Code:
    namespace Sun.SDK.Entity
    {
    public sealed class ResultEntity
    {
    public ResultEntity();
    
    
    public string StationID { get; set; }
    public string TagID { get; set; }
    public TagStatus TagStatus { get; set; }
    public int Signal { get; set; }
    public int Temperature { get; set; }
    public int Version { get; set; }
    public Power PowerLevel { get; set; } 
    // PowerLevel is the parameter I have to retrieve, but I don't know how..
    public decimal PowerValue { get; set; }
    public string BatchCode { get; set; }
    public int FuncKeyStatus { get; set; }
    public ResultType ResultType { get; set; }
    }
    }




    Ho can I retrieve power Level from public sealed class ResultEntity and import its in my main class?

  2. #2
    .NET Framework
    .NET 4.5
    Join Date
    Apr 2011
    Location
    Norway
    Posts
    423
    Rep Power
    107
    I think this should be it, see if this helps:
    foreach (var result in e.ResultList) {
    var level = result.PowerLevel;

    }
    [xcode=c#] code here [/xcode] - see bbcode list or use formatting buttons in posting editor.

    Visual Studio Community 2017

  3. #3
    .NET Framework
    .NET 1.1
    Join Date
    Sep 2018
    Posts
    1
    Rep Power
    0
    If you have used Microsoft® Visual Basic® or Microsoft Visual Studio .NET then you have used a property browser to browse, view, and edit the properties of one or more objects. The .NET Framework [B]PropertyGrid control is core to the property browser that is in Visual Studio .NET. The PropertyGrid control displays properties for any object or type, and it retrieves the item's properties, primarily using reflection. (Reflection is a technology that provides type information at run time.)
    http://www.zerobugacademy.com/dot-ne...ing-in-chennai
    dot net training in chennai

Similar Threads

  1. Code help - dynamic control properties
    By gabe.m in forum Windows Forms
    Replies: 4
    Last Post: 01-26-2017, 7:39 AM
  2. Question Beginner needs help with Class and properties.
    By Fezza in forum C# General Discussion
    Replies: 3
    Last Post: 08-22-2016, 3:49 AM
  3. FYI Amusing C# [Properties, Collection initialization, LINQ, etc.]
    By DracoConstellation in forum .NET Framework
    Replies: 0
    Last Post: 06-17-2016, 4:46 AM
  4. Access properties short form (with?)
    By Rhodan in forum C# General Discussion
    Replies: 2
    Last Post: 03-13-2016, 7:19 PM
  5. Question Problems with user control and public properties
    By Adagio.hpt in forum Component Development
    Replies: 1
    Last Post: 02-18-2015, 9:01 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •