c# - Will assigning a static object to another (non-static) variable make a copy of that object? -
i have static class holds static textures use throughout game.
public static class assetmanager { public static texture2d sometexture; .... }
my question is, if assign static texture variable in class, this:
texture2d classtexture = assetmanager.sometexture;
would creating copy of texture? i'm not thinking , reading it, don't think thats how static variable should work. tried out , checked hashcode of each , seemed same. i'm not sure if thats correct way checking , don't want run problem later on i'm creating bunch of new textures don't need.
c# never makes implicit copies of objects.
it kind of sounds caution may coming c++ background, in case can think of objects in c# being pointer.
Comments
Post a Comment