User Profile

Collapse

Profile Sidebar

Collapse
Sri13
Sri13
Last Activity: Mar 29 '11, 05:44 PM
Joined: Sep 9 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Serialization adds some wierd characters "d3p1:" to return string

    A third party web service method returns an object which we try to serialize into a string. When I use the following method to serialize the object, I see some text "d3p1:", "d4p1" prefixed with each tag and attribute. What is this and why does it add these characters?

    Code:
    public static string SerializeObject(Object pObject)
    {
      MemoryStream memoryStream = new MemoryStream();
      XmlSerializer xs
    ...
    See more | Go to post

  • How to retrieve data elements of an object when it refrences another object?

    How can I access the elements from the object obj in this example?

    Code:
    class Shapes
    {
      int shapeid;
      string name;
    }
    
    Shapes shape = new Shape();
    shape.shapeid = 10;
    shape.name = "roger";
    
    object obj = shape;
    How can I access obj.shapeid and obj.name??? This is just a hypothetical example. In real scenario I call a webservice method with a proxy, which...
    See more | Go to post

  • Dynamic casting of string to other .net objects like XMLElement, Color

    Hi

    I am trying to read the parameters of a method dynamically and then call that method with the passed parameter values (string type). I am able to write the code that reads the parameter of simple .net types like - string, int, float, double etc. I read them and convert to required type using ChangeType method. But I am not able to make the code work for other types like - XMLElement, Color, etc.

    Here is my generic...
    See more | Go to post

  • Thanks Gary for the response. I don't want to get the listo f built in datatypes. I want the list of possible values of those types. If I pass System.Boolean. Then it should return the possible values as "True" and "False". For Int, string etc it will be default values of 0, null etc. Also, I am not sure how to convert the datatype that is stored in a string variable to Type?
    See more | Go to post

    Leave a comment:


  • Determine the actual datatype stored in a string variable

    I have a string variable that stores the datatype name. Datatype name can be any datatype from native to user defined.
    Examples:
    string sType = "System.Boolean ";
    string sType = "System.Drawing .Color";
    string sType = "MyNamespace.My Class.Helper";

    Is there any easier (inbult) way to check if sType is a native type or a user defined type. And also, can I get the list of all the...
    See more | Go to post

  • Sri13
    started a topic How to initalize enum to null or blank?

    How to initalize enum to null or blank?

    Is there a way to initialize an enum to null/empty?

    Code:
    public enum Color
    {
      Red,
      Blue
    }
    How to do something:
    Color c = null;
    or
    Color c = "";
    See more | Go to post

  • I was able to resolve it myself :)
    I updated the inner loop to:
    Code:
    foreach (DataColumn dc in dr.Table.Columns) 
    { 
      nvEmp.Add(dc.ColumnName.ToString(), dr[dc].ToString()); 
    }
    See more | Go to post

    Leave a comment:


  • How to loop through DataRow[] to get the column name and value

    Hi
    I have a DataTable and get selected values out of it in a DataRow collection. I have the code that I want to make it run. Not sure if this is the correct approach to store column names and value in memory for later use?
    Code:
    DataTable dt = ds.Tables["Employee"];
    DataRow[] foundEmpRows = dt.Select("Dept = 10");
    
    NameValueCollection nvEmp = new NameValueCollection();
    foreach (DataRow
    ...
    See more | Go to post

  • Thanks for the response, I will try that.
    See more | Go to post

    Leave a comment:


  • Sri13
    started a topic How to open XML file from a ASP Hyperlink control

    How to open XML file from a ASP Hyperlink control

    How can I open a XML file from the location mentioned in the web.config file using Hyperlink control?

    I have an aspx page with hyperlink control and in code behind I do the following:

    Code:
    hypLink.Text = "Transformed XML";
    hypLink.NavigateUrl = ConfigurationSettings.AppSettings["OutputXML"];
    web.config looks like:

    Code:
    <add key="OutputXML" value="C:\Working\My
    ...
    See more | Go to post

  • How to rearrange datacolumns in a dataset from related datatables

    Hi

    I have 3 tables related by some keys. I add these three tables to a dataset and finally write to XML file. The XML file is then sent to the client. Since I added the relations, the XML shows proper hierarchy. I am facing an issue that the XML file shows the related data in sequencial order. Ex:
    Code:
    <table1>
      <table1_col1>col1</table1_col1>
      <table1_col2>col2</table1_col2>
    ...
    See more | Go to post
No activity results to display
Show More
Working...