I currently use the App_Code folder for all of my classes, and for me (for now) it seems to be working just fine.
I have however been considering making the switch over to a Class Library Project inside my Solution instead of the App_Code folder. Can anyone tell me the pros and cons of doing this?
One thought I had was with regards to testing my…
public class SelectionList<T> : ObservableCollection<SelectionItem<T>> where T : IComparable<T>
{
// Code
}
public class SelectionItem<T> : INotifyPropertyChanged
{
// Code
}
I need to create a property which is of the type SelectionList...as follows:
public SelectionList<string> Sports { get; set; }.
But…
I have a class that contains some data: class DATA
Now I would to create some functions that uses those data. I can do it easily by writing member functions like DATA::usedata();
Since there are hundreds of functions, I would to keep an order in my code, so I would like to have some "categories" (not sure of the correct name) like:
DATA data;…
Hello everyone!
I have a tricky question and probably what I want to do is not even possible but... who knows... Python seems very flexible and powerful...
I'd like to know if there's a way to access to the class (or its fields) where an object is instanciated. Let's say I have:
def Class1:
def __init__(self):
self.title =…
Is there any way I can load a class based on what version of the OS the phone is running?
For example:
I made an app which requires 1.6+ Android. Is there a way for me to load one class or the other based on what OS the phone is running? I'm asking this specifically for contacts.
The database was changed from 1.6 to 2.0 and the old…
I'm trying to use this tutorial to make plots with Gnuplot in C++. However I will be using the pipe to Gnuplot from within a class, but then I run into some problems:
I've got a header file where I declare all variables etc. I need to declare the pipe-variable here too, but how do I do that?
I've tried doing it straight away, but…
I have very basic class:
class Customer {
protected $id;
protected $customer;
public function __construct($customer_id) {
$this->id = $customer_id;
return $this->set_customer();
}
protected function set_customer() {
$query = mysql_query("SELECT * FROM customer WHERE id = '$this->id'");
…
i am learning classes in python and when i was reading the documentation i found this example that i didn't understand :
class MyClass:
"""A simple example class"""
def __init__(self):
self.data = []
i = 12345
def f(self):
return 'hello world'
then if we assign :
x = MyClass()…
Howdy - today a weird problem occured to me:
I have a modle class in Django and added a custom property to it that shall not be saved into the database and therefore is not represent in the models structure:
class Category(models.Model):
groups = models.ManyToManyField(Group)
title = defaultdict()
Now, when…
ok so im a newbie java dev using netbeans IDE 7.1.1 and im watching this tutorial and right off the bat i get an error in my program even after 5 retypes to make sure its exactly the same as in the video so anyways this is the error
Error: Could not find or load main class javagame.JavaGame
Java Result: 1
and this is…
This question was already asked in the context of C#/.Net.
Now I'd like to learn the differences between a struct and a class in (unmanaged) C++. Please discuss the technical differences as well as reasons for choosing one or the other in OO design.
I'll start with an obvious difference:
If you don't specify…
I have the following problem. I have this pretty class and now I want to get all the classes that extend that class (inner classes ) and fill 'classList' with it. ( in an automatic way of course )
public abstract class CompoundReference {
private static List<Class<? extends CompoundReference>>…
Recently i saw the following code that creates a class in javascript:
var Model.Foo = function(){
// private stuff
var a, b;
// public properties
this.attr1 = '';
this.attr2 = '';
if(Model.Foo._init === 'undefined'){
Model.Foo.prototype = {
func1 : function(){ //...},
func2 :…
I am running Windows 8 and have both Visual Studio 2010 Ultimate w/sp1 and Visual Studio 2012 Ultimate and I am trying to create a Portable Class Library that supports .net 3.5 and greater.
When I first try to create a PCL I get a screen like this:
I noticed that .net 3.5 is not in the list so I clicked…
I'm trying to make a method that takes an argument of Country.class, User.class etc, and returns argument.count().
All the possible classes that I would give to this method extend from Model and have the method count().
My code:
private static long <T> countModel(Model<T> clazz)
{
…
I've got a button class that you can instantiate like so:
engine.createElement((0, 0), Button(code=print, args=("Stuff!",)))
And when it is clicked it will print "Stuff!". However, I need the button to destroy itself whenever it is clicked. Something like this:
engine.createElement((0, 0),…
Take a look at this basic class:
namespace AcmeWeb
{
public string FirstName { get; set; }
public class Person
{
public Person(string firstName, string lastName)
{
if (String.IsNullOrEmpty(firstName))
{
throw new…
I have a custom class which I want to "load" inside the firstViewController and then access it from other classes by segues. My Problem is, I can't even access and change the instance variable inside the firstViewController. Somehow I'm "loading" it wrong. Here is the code I used…
I could not understand why my class does no t work. Returns nothing. Is there any mistake?
class User {
public $first_name;
public $last_name;
public function full_name() {
if(isset($this->first_name) && isset($this->last_name)) {
return…