类对象问题 [英] Class Object Problem

查看:112
本文介绍了类对象问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经定义了一个类如下:

  public   class  Blazer 
{
public string 肩膀{ get ; set ; }
public string SleeveLength { get ; set ; }
public string SleeveBottom { get ; set ; }
public string UpperChest { get ; set ; }
public string Chest { get ; set ; }
public string Belly { get ; set ; }
public string 腰围{ get ; set ; }
public string Hip { get ; set ; }
public string 长度{ get ; set ; }
public string CrossBack { get ; set ; }
public string 样式{ get ; set ; }
public string SpecialRequirement { get ; set ; }
public string 线程{ get ; set ; }
}





这里我定义了对象:

  public   static   void  SendMessage( string  obj)
{
try
{
JavaScriptSerializer序列化程序= new JavaScriptSerializer();
Blazer blazer = serializer.Deserialize< Blazer>(obj);
}
catch (例外)
{
throw ;
}
}





现在我的问题是如何获得所有值,即sholuder,... ...,线程以便我可以进一步使用它

解决方案

请参阅我对该问题的评论,请阅读: https://msdn.microsoft.com/en-us/library/bb355316%28v=vs.110%29。 aspx [ ^ ]。



有什么不清楚的吗?



-SA

I've defined a class as follow:

public class Blazer
    {
        public string Shoulder { get; set; }
        public string SleeveLength { get; set; }
        public string SleeveBottom { get; set; }
        public string UpperChest { get; set; }
        public string Chest { get; set; }
        public string Belly { get; set; }
        public string Waist { get; set; }
        public string Hip { get; set; }
        public string Length { get; set; }
        public string CrossBack { get; set; }
        public string Style { get; set; }
        public string SpecialRequirement { get; set; }
        public string Thread { get; set; }
    }



Here I defined the object:

public static void SendMessage(string obj)
    {
        try
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            Blazer blazer = serializer.Deserialize<Blazer>(obj);
        }
        catch (Exception)
        {
            throw;
        }
    }



Now my problem is how to get all the values i.e, sholuder,......,thread so that I can use it further

解决方案

Please see my comments to the question, read this: https://msdn.microsoft.com/en-us/library/bb355316%28v=vs.110%29.aspx[^].

Is anything unclear?

—SA


这篇关于类对象问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆