Declaring object type list in class file giving "missing a using directive or assembly reference” error
up vote
0
down vote
favorite
I am getting the titled error when I declare a list with object type in a class file in my Asp.Net web application. I have other classes running so the class system does work. The same declaration is fine in a webform c# code behind. Any help is appreciated.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Text;
/// <summary>
/// Summary description for TriviaUtilities
/// </summary>
public class TriviaClass
{
public TriviaClass()
{
//
// TODO: Add constructor logic here
//
}
public void getRegistration()
{
List<Activity> sampleREG = new List<Activity>();
}
}
UPDATE: Declaring List<int> sampleREG = new List<int>()
or List<string> sampleREG = new List<string>()
in the class file poses no problem and this works in a webform also as expected. Declaring the type as an object gives the namespace error in the class file but in the webform it is fine. Since it works on the webform and I have the same namespaces in both the webform and class files, I am suspecting that fixing this is complicated and it needs someone with a higher scope of programming to help with it.
c# asp.net list class object
|
show 10 more comments
up vote
0
down vote
favorite
I am getting the titled error when I declare a list with object type in a class file in my Asp.Net web application. I have other classes running so the class system does work. The same declaration is fine in a webform c# code behind. Any help is appreciated.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Text;
/// <summary>
/// Summary description for TriviaUtilities
/// </summary>
public class TriviaClass
{
public TriviaClass()
{
//
// TODO: Add constructor logic here
//
}
public void getRegistration()
{
List<Activity> sampleREG = new List<Activity>();
}
}
UPDATE: Declaring List<int> sampleREG = new List<int>()
or List<string> sampleREG = new List<string>()
in the class file poses no problem and this works in a webform also as expected. Declaring the type as an object gives the namespace error in the class file but in the webform it is fine. Since it works on the webform and I have the same namespaces in both the webform and class files, I am suspecting that fixing this is complicated and it needs someone with a higher scope of programming to help with it.
c# asp.net list class object
This doesn’t really help. What’s the full text of the error?
– stuartd
Nov 21 at 22:45
Maybe you missed including the namespace for your Activity class
– Quergo
Nov 21 at 22:46
Maybe you need to include any usings for custom classes created within your project
– Captain Wibble
Nov 21 at 22:47
If theActivity
class is defined like thisTriviaClass
class, then it's in the global namespace. That means it would have to be referenced likeglobal::Activity
. But the better solution in that case would be to put your classes inside of a namespace.
– Rainbolt
Nov 21 at 22:49
@stuartd Come on guys, stop the negativities. I've already stated that I have other classes working and the stated error is quite clear. Please stop giving comments that are not useful.
– matt2605
Nov 21 at 23:25
|
show 10 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am getting the titled error when I declare a list with object type in a class file in my Asp.Net web application. I have other classes running so the class system does work. The same declaration is fine in a webform c# code behind. Any help is appreciated.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Text;
/// <summary>
/// Summary description for TriviaUtilities
/// </summary>
public class TriviaClass
{
public TriviaClass()
{
//
// TODO: Add constructor logic here
//
}
public void getRegistration()
{
List<Activity> sampleREG = new List<Activity>();
}
}
UPDATE: Declaring List<int> sampleREG = new List<int>()
or List<string> sampleREG = new List<string>()
in the class file poses no problem and this works in a webform also as expected. Declaring the type as an object gives the namespace error in the class file but in the webform it is fine. Since it works on the webform and I have the same namespaces in both the webform and class files, I am suspecting that fixing this is complicated and it needs someone with a higher scope of programming to help with it.
c# asp.net list class object
I am getting the titled error when I declare a list with object type in a class file in my Asp.Net web application. I have other classes running so the class system does work. The same declaration is fine in a webform c# code behind. Any help is appreciated.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Text;
/// <summary>
/// Summary description for TriviaUtilities
/// </summary>
public class TriviaClass
{
public TriviaClass()
{
//
// TODO: Add constructor logic here
//
}
public void getRegistration()
{
List<Activity> sampleREG = new List<Activity>();
}
}
UPDATE: Declaring List<int> sampleREG = new List<int>()
or List<string> sampleREG = new List<string>()
in the class file poses no problem and this works in a webform also as expected. Declaring the type as an object gives the namespace error in the class file but in the webform it is fine. Since it works on the webform and I have the same namespaces in both the webform and class files, I am suspecting that fixing this is complicated and it needs someone with a higher scope of programming to help with it.
c# asp.net list class object
c# asp.net list class object
edited Nov 22 at 0:06
asked Nov 21 at 22:42
matt2605
105113
105113
This doesn’t really help. What’s the full text of the error?
– stuartd
Nov 21 at 22:45
Maybe you missed including the namespace for your Activity class
– Quergo
Nov 21 at 22:46
Maybe you need to include any usings for custom classes created within your project
– Captain Wibble
Nov 21 at 22:47
If theActivity
class is defined like thisTriviaClass
class, then it's in the global namespace. That means it would have to be referenced likeglobal::Activity
. But the better solution in that case would be to put your classes inside of a namespace.
– Rainbolt
Nov 21 at 22:49
@stuartd Come on guys, stop the negativities. I've already stated that I have other classes working and the stated error is quite clear. Please stop giving comments that are not useful.
– matt2605
Nov 21 at 23:25
|
show 10 more comments
This doesn’t really help. What’s the full text of the error?
– stuartd
Nov 21 at 22:45
Maybe you missed including the namespace for your Activity class
– Quergo
Nov 21 at 22:46
Maybe you need to include any usings for custom classes created within your project
– Captain Wibble
Nov 21 at 22:47
If theActivity
class is defined like thisTriviaClass
class, then it's in the global namespace. That means it would have to be referenced likeglobal::Activity
. But the better solution in that case would be to put your classes inside of a namespace.
– Rainbolt
Nov 21 at 22:49
@stuartd Come on guys, stop the negativities. I've already stated that I have other classes working and the stated error is quite clear. Please stop giving comments that are not useful.
– matt2605
Nov 21 at 23:25
This doesn’t really help. What’s the full text of the error?
– stuartd
Nov 21 at 22:45
This doesn’t really help. What’s the full text of the error?
– stuartd
Nov 21 at 22:45
Maybe you missed including the namespace for your Activity class
– Quergo
Nov 21 at 22:46
Maybe you missed including the namespace for your Activity class
– Quergo
Nov 21 at 22:46
Maybe you need to include any usings for custom classes created within your project
– Captain Wibble
Nov 21 at 22:47
Maybe you need to include any usings for custom classes created within your project
– Captain Wibble
Nov 21 at 22:47
If the
Activity
class is defined like this TriviaClass
class, then it's in the global namespace. That means it would have to be referenced like global::Activity
. But the better solution in that case would be to put your classes inside of a namespace.– Rainbolt
Nov 21 at 22:49
If the
Activity
class is defined like this TriviaClass
class, then it's in the global namespace. That means it would have to be referenced like global::Activity
. But the better solution in that case would be to put your classes inside of a namespace.– Rainbolt
Nov 21 at 22:49
@stuartd Come on guys, stop the negativities. I've already stated that I have other classes working and the stated error is quite clear. Please stop giving comments that are not useful.
– matt2605
Nov 21 at 23:25
@stuartd Come on guys, stop the negativities. I've already stated that I have other classes working and the stated error is quite clear. Please stop giving comments that are not useful.
– matt2605
Nov 21 at 23:25
|
show 10 more comments
1 Answer
1
active
oldest
votes
up vote
0
down vote
Yes, Rainbolt, Captain Wibble, Quergo. The original use of the object type for the list is in a web page that contains 3000 lines. Buried in there was the Activity class that the IDE was looking for, for the Activity object type of the list.
See here to create a class.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Yes, Rainbolt, Captain Wibble, Quergo. The original use of the object type for the list is in a web page that contains 3000 lines. Buried in there was the Activity class that the IDE was looking for, for the Activity object type of the list.
See here to create a class.
add a comment |
up vote
0
down vote
Yes, Rainbolt, Captain Wibble, Quergo. The original use of the object type for the list is in a web page that contains 3000 lines. Buried in there was the Activity class that the IDE was looking for, for the Activity object type of the list.
See here to create a class.
add a comment |
up vote
0
down vote
up vote
0
down vote
Yes, Rainbolt, Captain Wibble, Quergo. The original use of the object type for the list is in a web page that contains 3000 lines. Buried in there was the Activity class that the IDE was looking for, for the Activity object type of the list.
See here to create a class.
Yes, Rainbolt, Captain Wibble, Quergo. The original use of the object type for the list is in a web page that contains 3000 lines. Buried in there was the Activity class that the IDE was looking for, for the Activity object type of the list.
See here to create a class.
answered Nov 22 at 8:43
matt2605
105113
105113
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421447%2fdeclaring-object-type-list-in-class-file-giving-missing-a-using-directive-or-as%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This doesn’t really help. What’s the full text of the error?
– stuartd
Nov 21 at 22:45
Maybe you missed including the namespace for your Activity class
– Quergo
Nov 21 at 22:46
Maybe you need to include any usings for custom classes created within your project
– Captain Wibble
Nov 21 at 22:47
If the
Activity
class is defined like thisTriviaClass
class, then it's in the global namespace. That means it would have to be referenced likeglobal::Activity
. But the better solution in that case would be to put your classes inside of a namespace.– Rainbolt
Nov 21 at 22:49
@stuartd Come on guys, stop the negativities. I've already stated that I have other classes working and the stated error is quite clear. Please stop giving comments that are not useful.
– matt2605
Nov 21 at 23:25