.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Expeting array of object instead of arraylist

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :ASP.Net

Hi all..

  i have an method in wcf which takes ArrayList object in parameter and returns an arraylist object.

 There s no problem here...

  But in client application that method expects array of objects instead of arraylist...

  how to solve this problem...

View Complete Post

More Related Resource Links

Converting ReportDocument object into byte array ?


Hi All,

          Is it possible to convert the Report Document object as a byte array and store it in SQL , later retrieve and assing it to a report ?


Query an arraylist of array list using linq


I have an array list called Customer. I t holds a list of array list which has the account details.

proj.customer -> collection of arraylist of type customer

proj.customer.account -> collection of arraylist of type account

Account array list holds type account and it has a poperty account balance. How can I query all accounts which has account balance  >100

I tried the following one

var Accountlist= from Account accountdetails in proj.customer.account

where accountid.balance >100

select accountdetails.id

But it is always throwing an error saying cannot cast type customer to type account

Please help

How to: Serialize Hashtable contained inside another object that is serialized as an array of object

Update:  I've added the entire program in a single block of C# text near the end of these posts that can be placed into a C# Program.cs file of a console project.   I have a class called MyHashtable that inherits from Hashtable and implements IXmlSerializable.  MyHashtable is contained inside another object called MyObject and I need to xml serialize an array of MyObject[].  Whenever I xml deserialize, the hashtable is deserialized, but only 1 of MyObjects from the MyObject[] array is deserialized.  The ReadXml uses "while (reader.NodeType != XmlNodeType.EndElement)" so I don't think the reader is consuming all of the xml internally.   Does anyone know why this is happening?  Thanks.    

How to create an extremely large array/object (> 2 GB) without using jagged arrays ?

Hello,I had implemented a matrix scaling algorithm in Java (64-bit) for a university project and have now implemented the code in C# with .NET 3.5 64-bit. One of the operations I did in Java was creating a rectangular array with double[][] = ... (in C# this is a jagged array!) to store a symmetric matrix which is used as input for the algorithm. Since I was using matrices with n up to 30720, memory usage for the single matrix object was around 8 GB in it's maximum and with matrix multiplication around 20 GB.So... now I implemented this in C# and I am shocked to see that double[,] (rectangular arrays) can only be 2 GB in size even on 64-bit! That means that for matrices with n larger than ~15000 I will get OutOfMemory Exceptions although there is a huge amount of free memory (I have two quad core systems with 12 GB and 24 GB Ram). When I use jagged arrays in C# (i.e. double[][]) I can create larger matrices. That is because I have one small array with the size of the row number (i.e. n) and then for each row an array of size n, but they are all single objects so I don't reach the 2 GB per object limit. The problem with jagged arrays is that they are horribly slow for matrice calculations compared to rectangular arrays and even slower compared to single dimension arrays.Actually I intended to rewrite my code and simulate the matrices in single arrays (see sample code below) bec

Converting a System.Windows.Control.Image object to byte array.

Hi i need to convert a specific System.Windows.Control.Image object into an (int) array, because i'm trying to convert a silverlight application into a wpf project. private void createGi02GradBrush()<br/> {<br/> WriteableBitmap oWriteableBitmap = new WriteableBitmap(256, 256);<br/> Image oImage = new Image();<br/> oImage.Arrange(new Rect(0, 0, 256, 256));<br/> oImage.Measure(new Size(256, 256));<br/> oImage.Source = new WriteableBitmap(256, 256);<br/> Gi02GradShaderEffect oGi02GradShaderEffect = new Gi02GradShaderEffect();<br/> oGi02GradShaderEffect.pArray = oPImageBrush;<br/> oGi02GradShaderEffect.gi1GradArray = oGi1GradImageBrush;<br/> oImage.Effect = oGi02GradShaderEffect;<br/> oWriteableBitmap.Render(oImage, null);//here<br/> oWriteableBitmap.Invalidate(); <br/> this.oGi02GradImageBrush = new ImageBrush();<br/> this.oGi02GradImageBrush.ImageSource = oWriteableBitmap;<br/> } I've found some similar topics however Image object is not the same and most of its methods aren't available. Here I'm rendering a writablebitmap with a given Image object, but in wpf we need an array. oWriteableBitmap.Render(oImage, null); Any idea? Thanks. Joseph.  

how to query return all data in Array Object ,Collection Object

how to query return all data in Array Object ,Hash Table ,And DataTable dataRowSelect * From Doc a

how to Input data from textbox to unknown size of array or arraylist?


I am fresh to asp.net. I m using vb to write it. Could someone who is professional guide me?

I want to input data from textbox to "unknown size" array or arraylist, and bind it to gridview.

I have more than 1 data to input. Do i need to use loop to bind?

Thank you for your kind attention and patient.

Converting an Image/BitmapImage object into Byte Array and vice versa

Hi,  I have an requirement of developing an application (WPF) that recevies image object from WCF service.

my approch is to convert the image object into stream of bytes (Byte array) in WCF part and then send to  client application. Then client application converts the byte array back to image object.

I am not able to find right sample for my approach.

would you give me guidance and would be gr8 if you provide some samples.


Error: Object reference not set to an instance of an object for an array in vb.net


I have the following code

Dim ls_case_no() As String = Nothing
 Dim li_case_count As Integer = 0

  Dim li_case As String = ""
         li_case = xmlLocNode.InnerText
                                            If Not li_case = "" Then
                                                'li_case = li_case.Replace("-", "")
                                                ls_case_id = li_case

                                                ReDim Preserve ls_case_no(li_case_count)
                                                li_case_count = li_case_count + 1
                                                ls_case_no(li_case_count - 1) = ls_case_id
                                            End If

 myNode = xmlLocNode.SelectSingleNode("nc:CaseTrackingID", nsMgr)
                                             If Not myNode.InnerText = "" Then
                                                Dim li_case As String = myNode.InnerText
                                               lbl_caseno.Text = li_case
                                                ls_case_core = li_case
                                            End If

 If Not ls_case_no.Length = 0 Then
            For d = 0 To ls_case_no.Length - 1
                If Not ls_case_no(d) = ls_case_core Then

how do you get object array number in a method?


Lets say you have four array objects.

test[1] = new test();

test[2] = new test();

test[3] = new test();

test[4] = new test();

then you have your class:

public class test()


   public int i; //initialize some fields

   public int getnumber()


  // what is the array number of the this object? 1, 2, 3, or 4???



so basically, if an object is called: test[1].getnumber   how can this method internally determine what object array number it is currently in?  (without passing an integer from the page)

  it can be either 1, 2,3, or 4.

How to add double integer array to ArrayList. Then iterate through the list and delete an item?


   I have a class with three students in it. Each student has two test scoress for the semester.
   How do I iterate through my ArrayList?

   Also suppose I want to remove a student score from the ArrayList while iterating through the list, How can I do this ?

   An example is if I allow Hallie to drop her lowest score of 71

            int Students=3;
            int Scores = 2;
            int[,] Student = new int[Students, Scores];

            ArrayList Class = new ArrayList();
            // Add joes scores
            Student[0, 0] = 88;
            Class.Add(Student[0, 0]);
            Student[0, 1] = 99;
            Class.Add(Student[0, 1]);

            // Add Maries Scores

How do I generate a hashcode from a object array in c#


Hi All,

I'm using code below for generate a hashcode, but i think it's not good solution...

static int GetHashCode(ICollection c)
      StringBuilder sb = new StringBuilder();

      foreach (object o in c)

      return sb.ToString().GetHashCode();

What do you think about this?

NullReferenceException in array? Object reference not set to an instance of an object.


I am receiving a NullReferenceException, but I can not find where it is.

The code:

string[] strAccount = null;
DateTime[] dtFirstPurchDate = null;
DateTime[] dtLastPurchDate = null;
TimeSpan[] dtFirstLastPurchDiff = null;


//Start iterating through the original gridview with line item totals
for (int i = 0; i <= GridViewECI.Rows.Count-1; i++)


if (i == 0)
//set first gridview records so we can use it to review next lines of data

                   strAccount[counter] = GridViewECI.Rows[i].Cells[0].Text;
                    dtFirstPurchDate[counter] = DateTime.Parse(GridViewECI.Rows[i].Cells[1].Text);

<-- error occurs here at dtFirstPurchDate with Object reference not set to an instance of object

Sending js Array object in jQuery Ajax post

The article Sending js Array object in jQuery Ajax post was added by tmorton on Thursday, May 12, 2011.

The post name should be "Serializing to JSON in jQuery" or something like that but I kind of twisted it the way I faced this issue. If you're looking for how to do the ajax calling in jQuery and blah da. then you should keep googling cause this post ain

Thinking about new C# method prototypes: object as dictionary

I recently had to write a small Flickr API. I know many .Net API for Flickr already exist but I needed one for a Silverlight application. Whatever, it's only about building some querystrings so I did it by myself. It's been an opportunity to think again about a classical question: how to pass parameters to a method ?

Imagine you have a generic method to call some Flickr functions.

C# Object Oriented Programming

So far in C# Essentials we have looked at the basics of programming in C# such as variable types and flow control. Although it would be possible to write a functional program using these techniques, there is much more to becoming a proficient C# programmer. C# is, above all, an object oriented programming language and as such any C# programmer will be expected to create object-oriented applications using this language.

Object Oriented Programming

Four core concept of OOP Object Oriented Programming. 1.Inheritance, 2.Polymorphism, 3.Abstraction and 4.Encapsulation
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend