coder
coder

Reputation: 2000

access a value returned by partial class

I am Working in asp.net and c#.

I have a partial class in my application.One of the methods of this class returns a value( value is a dataset) like return value;

example code:

      public partial class CommonClass : IDisposable
      {
        public static dataset somemethod(string somevariable)
          {

             //some code


             return variable;

          }


      }

Now i want to access the value of variable in my codebehind.How can i do that.please give some sugessions..

NOTE:variable is a dataset..

Upvotes: 2

Views: 578

Answers (2)

Adil
Adil

Reputation: 148150

You can call the static method somemethod of your class CommonClass. You can read more about static and instance methods here.

DataSet ds = CommonClass.somemethod("somevalue");

Upvotes: 1

Pranay Rana
Pranay Rana

Reputation: 176934

just like this you can do it as method is static there is no need to create any instance of class you can call it as below

DataSet  ds =CommonClass.somemethod("mydata") ;

Upvotes: 4

Related Questions